I am showing a custom accessory view within my uitableview using the code below. Is it possible to target the accessory image as clickable? Do I need to make it a action? I need to make only the image clickable as within didSelectRowAtIndexPathI am producing a alert for another function.

cell.accessoryView = [[ UIImageView alloc ]
                          initWithImage:[UIImage imageNamed:@"acc_icon.png"]];
有帮助吗?

解决方案

You can make the accessory view a button or keep the image view and add a gesture recognizer (be sure to enable user interaction).


Instead of

[[UIImageView alloc] initWithImage...

Use

[UIButton buttonWithType...

And configure the button target, action, image / text.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top