I added some test 3D Touch functionality on the UITableViewController on iPhone 6s. In general, it works fine, but I was able to observe several problems, and I'm not sure what is happening and how to fix it in the usual way.
1) My cell is selected, so the user can click it or use "3D Touch". The problem is that when I use "Pop" and "Peek" for a UITableViewCell , it is selected, and I cannot deselect it the usual way using the setSelected: or setHighlighted: methods. I tried to deselect in different places even in previewingContext:commitViewController in presentViewController . They simply do nothing, and the cells still remain in the selected state. I got the selected cell by calling reviewingContext.sourceView and another temporary code that gave me the selected cell, but these methods did not work.
- So, the question is, is there a normal way to deselect (or better not to select) a cell when the user clicks on it "Pop"?
2) I also noticed that sometimes when I cancel the “Pop” gesture and transfer the cell to its original state (when the previewingContext:viewControllerForLocation method was not even called), my user interface just hangs and does not respond to touch at all. I need to kill for it to work. It seems very strange, I checked this Tutorial . It works fine without the mentioned problems, but they register the delegate not in the cell, but on the UITableView , so the "Pop" gesture selects the entire tableView, but not the cell.
- Any thoughts and what could be wrong here?
This is how I applied the 3D sensor in my UITableViewController test, which corresponds to the UIViewControllerPreviewingDelegate
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("SomeDemoID", forIndexPath: indexPath) as! UITableViewCell
Thanks in advance!
source share