ProMotion icon indicating copy to clipboard operation
ProMotion copied to clipboard

Custom Accessory View Not Clickable

Open fvonhoven opened this issue 9 years ago • 4 comments

Here's an example of the problem: https://github.com/fvonhoven/pm_bug_accessory_view

I'm unable to capture my click on the UIImageView, seems like a bug.

fvonhoven avatar Jul 07 '15 17:07 fvonhoven

did you set the userInteractionEnabled to true? From what I recall I think a UIImageView is false by default, so clicks wouldn't be recognized.

squidpunch avatar Jul 07 '15 17:07 squidpunch

looks like you did enable them though, and i see its about an accessory view (sorry I read too quickly the first time)

If nobody else gets to digging into this, I will try and check it out sometime in the next couple of days or so.

squidpunch avatar Jul 07 '15 18:07 squidpunch

@fvonhoven Thanks for reporting the issue, and sorry it's taken so long for us to get back to you.

I did some investigating on this issue this morning and you are correct that this does not work as documented. According to Apple's documentation, the only method that I can find that would allow us to hook in and connect your method to an event only applies to Disclosure Button accessory views. https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableViewDelegate_Protocol/index.html#//apple_ref/occ/intfm/UITableViewDelegate/tableView:accessoryButtonTappedForRowWithIndexPath:

And this StackOverflow answer confirms: http://stackoverflow.com/a/869643/811307

I'll keep trying to think of a way that we can implement this on our side, but I'm no Obj-C master (yet), so your best bet may be to implement your action on your UIImageView (possibly by wrapping it in a UIButton) for now.

@jamonholmgren Any input on this?

kevinvangelder avatar Aug 05 '15 19:08 kevinvangelder

@fvonhoven I also apologize, i said "if nobody gets to this il check in a few days"....29 days ago you could probably capture a click using an rmq event on the UIImageView as well (maybe) but if you want it to hit the delegate, sounds like based on what @kevinvangelder said it's not going to work unless its a button...

squidpunch avatar Aug 05 '15 19:08 squidpunch