How to make xib compatible with both iphone 5 and iphone 4 devices

前端 未结 14 1753
执念已碎
执念已碎 2020-11-28 20:39

I am trying to layout my xib so that layout fits in both iphone 5 (4 inches retina) and 3.5 devices.

Because I have to support IOS-5 I cannot use autolayout. I have

相关标签:
14条回答
  • 2020-11-28 21:20

    Try adding this to all your controllers which need to support iPhone 5:

    - (void) loadView
    {
        [super loadView];
        self.view.frame = [UIScreen mainScreen].bounds;
    }
    
    0 讨论(0)
  • 2020-11-28 21:21

    I was having an issue with 3.5" vs. 4" as well, and I misunderstood what was wrong so I wanted to document it here incase it helps anyone.

    If you are trying to access self.view.frame it will not be correctly reported until viewDidAppear or some similar event. If you try to access self.view.frame from within viewDidLoad then you can be reported the dimensions of the frame before autosizing takes place.

    0 讨论(0)
提交回复
热议问题