Can't tap buttons on the left side of 4" iPhone

后端 未结 2 510
青春惊慌失措
青春惊慌失措 2021-01-15 03:49

This is absolutely confusing. On a 3.5\" iPhone simulator, all of the UIButtons on my app work just fine. However, when I launch on the 4\" iPhone simulator, all of the UIBu

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-15 04:24

    Let me guess, this happens only in the landscape mode, right ? I had the same issue in my app when I was developing specifically for the iPhone-4S. But when I began testing on the iPhone-5, touches on the bottom did not work. It were the frame. Make sure frames are set to bounds, both in the code, and the XIB file (if there is one). Different frames/bounds in the man and xib files, might also result in such behaviour.

    I eventually removed the xib files, and did everything programmatically. One thing I learnt was, set your frames in viewWillAppear or viewDidAppear methods instead of viewDidLoad. Also check the frame/bounds in your RootViewController. One last thing, try not to use constant value for frames, use referential frames with respect to superview.

    PS, one way to know if it really is the frames/bounds that are responsible for this behaviour is, setting the masksToBounds to YES, for the views. That way, your views will not be visible outside their rects.

提交回复
热议问题