Skip to content

Instantly share code, notes, and snippets.

@cybertk
Created August 20, 2015 08:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cybertk/2befc00818c1ea6227fc to your computer and use it in GitHub Desktop.
Save cybertk/2befc00818c1ea6227fc to your computer and use it in GitHub Desktop.
Clear all selections of UITableView
//
// UITableView+ClearSelections.swift
// Cybertk
//
// Created by Quanlong He on 8/20/15.
// Copyright © 2015 Quanlong He. All rights reserved.
//
import Foundation
extension UITableView {
// Clear all selections
func clearSelections(animated: Bool) {
if let indexPaths = self.indexPathsForSelectedRows {
for indexPath in indexPaths {
self.deselectRowAtIndexPath(indexPath, animated: animated)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment