UITableView cell 的选中操作

关于选中的 API :

//  编辑模式的 api
public var editing: Bool // default is NO. setting is not animated.
public func setEditing(editing: Bool, animated: Bool)

// 是否允许选中控制的 api
// 允许单选
public var allowsSelection: Bool // default is YES. Controls whether rows can be selected when not in editing mode
// 允许在编辑模式下进行单选
public var allowsSelectionDuringEditing: Bool // default is NO. Controls whether rows can be selected when in editing mode
// 允许多选
public var allowsMultipleSelection: Bool // default is NO. Controls whether multiple rows can be selected simultaneously
// 允许在编辑模式进行多选
public var allowsMultipleSelectionDuringEditing: Bool // default is NO. Controls whether multiple rows can be selected simultaneously in editing mode


// 当前选中的索引的获取
// 获取当前选中单行的索引
 public var indexPathForSelectedRow: NSIndexPath? { get } // returns nil or index path representing section and row of selection.
// 获取当前选中多行的索引
public var indexPathsForSelectedRows: [NSIndexPath]? { get } // returns nil or a set of index paths representing the sections and rows of the selection.

// 自己进行选中的操作
public func selectRowAtIndexPath(indexPath: NSIndexPath?, animated: Bool, scrollPosition: UITableViewScrollPosition)
public func deselectRowAtIndexPath(indexPath: NSIndexPath, animated: Bool)

你可能感兴趣的:(UITableView cell 的选中操作)