简体   繁体   中英

Increase tappable area on UITableView

I'm testing a new iPhone app with my end-users and found that a lot of times they misses the clickable area of a UITableCell and perform the wrong action. (Some users never before use any kind of computer!).

Then I try myself and found that still I can fail sometimes. So I wonder how increase the tappable area of the cell with accessoryType = UITableViewCellAccessoryDetailDisclosureButton

I try reducing the width of the contenview but still fail. I think is necesary hit exactly thw blue arrow to hit it.

I want something like the last 1/4 of the cell be the hit area.

This thread has a pretty good block of code showing how to do it. Read down to the comments; the code in the blog post itself is not correct. (This link is no longer valid.)

The key is to overload -hitTest:withEvent: for the UITableViewCell. You will be passed a point, and you can then return any view you want as the view that is being touched.

For fun, you might try changing the frame of the accessory view and seeing what happens. I doubt this will work as well as the -hitTest:withEvent: overload, but it's so easy that it's worth trying.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM