开发者

iPad: IBAction for UIButton responds on iPhone device, not on iPad

I have taken over the development and maintenance of a production iOS application being used mostly on the iPhone but also on the iPad. We found a specific UIButton that will respond as expected on the iPhone (device & simulator) but does not respond on the iPad 开发者_高级运维(device & simulator).

I am lost on where to start debugging this item. Any suggestion? Thanks in advance.


Kinda late to this party, but I had this symptom as well. The problem was my button was embedded in a view that had has height of 44 in IB, but when running shrunk to 0. It's contents rendered just fine, which made it hard to track down. Once I added a height constraint to the containing view, my UIButton now responds as expected. My guess is that the shorter height running on the iPad squished my containing view.


So it looks like this one was pretty easy for me.

[self.view bringSubviewToFront: button]; //moves the button above other subviews
[button setNeedsDisplay]; //ensure the button is redrawn

I am still not sure why this only happens when running on an iPad, but this fixed my problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜