Getting or setting the hit area of UIButtonTypeInfoLight

偶尔善良 提交于 2019-12-03 20:40:07

I'm not sure about looking up the specific rect of the hit area from code, but there is a way that you can specifically set the area that will be tappable. You can subclass your UIButton and override UIView's hitTest:withEvent: to set the area. Here's an example that shows expanding the hit area, but I'm pretty sure you could use it to decrease the area as well: Larger Hit Area for UIButton

I suppose you could use trial and error with this method to tap areas and find out what is or isn't within the hit area's bounds. I know it's not ideal, but that's what I've found.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!