Touch area changing on custom UIButton with image and title on landscape mode

我怕爱的太早我们不能终老 提交于 2019-12-11 18:16:55

问题


I'm trying to build a button that looks like the icons on the iphone , with an image and a title bellow.I'm working in landscape mode. I have a custom button on the IB with image and title and inside the code I use the methods :


[aButton setTitleEdgeInsets:UIEdgeInsetsMake(60.0, -50.0, 0.0, 0.0)];
[aButton setImageEdgeInsets:UIEdgeInsetsMake(-10.0, 29.0, 0.0, 0.0)];
my problem is that the area that react to the touch events is very small and is on the top left of the button , another problem is that if I change my button size I have to calculate again manually the values for these 2 functions. Is there any easy way to do it?and if not how can I fix the touch area? thanks Gilad

回答1:


well , I just removed the NIB file and created a new one and everything works just fine




回答2:


Ran into this one as well, but didn't see the limited touch area until recently. Rebuilding the nib now and it's working. Thanks for plowing this ground.



来源:https://stackoverflow.com/questions/2502812/touch-area-changing-on-custom-uibutton-with-image-and-title-on-landscape-mode

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