PathMenu icon indicating copy to clipboard operation
PathMenu copied to clipboard

Response to Touches Delayed

Open lnjustin opened this issue 9 years ago • 3 comments

I have the path menu implemented as a subview to a tableview cell. For some reason, opening the menu only occurs by pressing and holding the start menu item down for a half second or so. And menu items aren't being selected until they are held down for at least a second or more. There seems to be an issue with touches when implemented as a subview to a cell.

lnjustin avatar Jun 10 '15 01:06 lnjustin

@lnjustin Thank you for comment. I'll check this latency.

pixyzehn avatar Jun 11 '15 00:06 pixyzehn

Great, thanks very much. I have determined that touchesCancelled is being called in PathMenuItem when a non-start menu item is tapped. That is, touchesBegan is called, but rather than calling touchesEnded when tapped, touchesCancelled is being called. That means PathMenuItemTouchesEnd is never being called. I can call it manually by rewriting: public func PathMenuItemTouchesBegan(item: PathMenuItem) { if (item == self.startButton) { self.handleTap() } else { self.PathMenuItemTouchesEnd(item) } }

But that seems like a risky hack, and it doesn't animate. I've tried setting delaysContentTouches = false and canCancelContentTouches = true for my subclassed tableview. And overriding touchesShouldCancelInContentView as follows. But it still doesn't work. Any help would be much appreciated so that your awesome menu can work when in a tableview cell! override func touchesShouldCancelInContentView(view: UIView!) -> Bool { println("in touches should cancel (view.tag)") if (view.tag == 99 || view.tag > 999 || view is PathMenuItem || view is PathMenu) { println("in if in touches should cancel") return true } return super.touchesShouldCancelInContentView(view) }

lnjustin avatar Jun 11 '15 01:06 lnjustin

@lnjustin Thank you for the detailed explanation.

pixyzehn avatar Jun 11 '15 04:06 pixyzehn