swift - didSelectRowAtIndexPath only working on long press if embedded in container view -
this question has answer here:
- uitableview need long press select row 4 answers
i'm creating prototype app uses exact same uitableviewcontroller class file 2 different scenarios.
- the first scenario displaying list of newly created "project" items. in scenario using regular table view controller in storyboard.
- the second scenario allows user select existing "project" items in different view. in scenario have regular view controller has container view. container view uses embedded tableview controller display selectable list.
to clear, here how second scenario looks:
remember, both using exact same class file. first scenario works while second scenario calls didselectrowatindexpath
on long press, taps don't work @ all.
override func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { print("fires") // scenario 2 not fire until long press if selectable { guard let cell = tableview.cellforrowatindexpath(indexpath) else { return } cell.accessorytype = (cell.accessorytype == .checkmark) ? .none : .checkmark } }
my question
with table view controller embedded in container view, how can didselectrowatindexpath fire on tap rather long press?
i had similar issue caused container view not implementing touch methods , passing them chain calls super:
override func touchesbegan(touches: set<uitouch>, withevent event: uievent?) { super.touchesbegan(touches, withevent: event)
i didn't have touch functionality in container, still calls needed made , passed chain in order table view act on them.
Comments
Post a Comment