Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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