2

I have created a UIView (yellow) in storyboard and then dragged two other UIViews (green and red) by dragging them inside the yellow one. It looks fine in Xcode storyboard.

When I run in the simulator the green and red UIViews don't show up? The only simulator it works in is when the device is set to iPhone Retina 4. The screen below is iPhone Retina 3.5.

Any ideas on what the issue might be?

enter image description here

UPDATE: Image to show storyboard structure.

enter image description here

jdog
  • 10,351
  • 29
  • 90
  • 165

3 Answers3

2

Ok fixed this. The issue is autolayout. I had to setup constraints for the red and green UIViews, such as pin height and pin widths.

jdog
  • 10,351
  • 29
  • 90
  • 165
1

You need to resize the views to adjust them for the different heights. Right now, the view is clipped because of Autolayout and the red & green buttons are hidden on the upper side.

A very easy way is to use AutoResizing flags from the xib itself! Just click on the individual component(UIButton, UILabel,etc) and change the flags as you can see below: enter image description here

Do this programmatically for complex UIs.

tipycalFlow
  • 7,594
  • 4
  • 34
  • 45
  • 1
    With Autolayout on you don't have these options. – jdog Feb 16 '13 at 05:37
  • Again, if you set the simulator to iPhone 4 Retina everything shows up perfectly. I think it has something to do with autolayou/ constraints on old devices. – jdog Feb 16 '13 at 05:41
  • `Autolayout` does not work for pre-iOS 6! Check [this SO question](http://stackoverflow.com/questions/12411980/enabling-auto-layout-in-ios-6-while-remaining-backwards-compatible-with-ios-5). You wouldn't want to handle it differently for different iOS! – tipycalFlow Feb 16 '13 at 06:13
1

I resolved this issue by setting proper corner radius.

Mohammad Zaid Pathan
  • 16,304
  • 7
  • 99
  • 130