fix willSelect

This commit is contained in:
Max Sokolov 2016-06-12 17:01:44 +03:00
parent 653948ec08
commit 272d238a2a
2 changed files with 13 additions and 6 deletions

View File

@ -64,6 +64,10 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate
// MARK: - Internal -
func hasAction(action: TableRowActionType, atIndexPath indexPath: NSIndexPath) -> Bool {
return sections[indexPath.section].items[indexPath.row].hasAction(action)
}
func didReceiveAction(notification: NSNotification) {
if let action = notification.object as? Action, indexPath = tableView?.indexPathForCell(action.cell) {
@ -160,11 +164,14 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate
public func tableView(tableView: UITableView, shouldHighlightRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return invoke(action: .shouldHighlight, cell: tableView.cellForRowAtIndexPath(indexPath), indexPath: indexPath) as? Bool ?? true
}
/*func tableView(tableView: UITableView, willSelectRowAtIndexPath indexPath: NSIndexPath) -> NSIndexPath? {
return invokeAction(.willSelect, cell: tableView.cellForRowAtIndexPath(indexPath), indexPath: indexPath) as? NSIndexPath
}*/
public func tableView(tableView: UITableView, willSelectRowAtIndexPath indexPath: NSIndexPath) -> NSIndexPath? {
if hasAction(.willSelect, atIndexPath: indexPath) {
return invoke(action: .willSelect, cell: tableView.cellForRowAtIndexPath(indexPath), indexPath: indexPath) as? NSIndexPath
}
return indexPath
}
// MARK: - Sections manipulation -

View File

@ -64,7 +64,7 @@ class MainController: UIViewController {
tableDirector += [section]
tableDirector.append(section: section)
//tableDirector.append(section: section)