I'm pretty new to using Apple NSAutolayout
. In the easiest example I could imagine I created tabbed iPhone App with default template. Then in first view i added UISegmentedControl
and add 2 constraints to him: "Align Center X to: SuperView" and "Bottom Space to: Bottom Layout Guide". Then when I run app the UISegmentedControl
position is correct but when I switch to the second view and go back, the UISegmentedControl
goes down and becomes hidden by UITabBar
. When I rotate device the segmented control position goes back to the right place.
Is there a solution to avoid this?
EDIT: Few snapshots to show problem.
Before http://img824.imageshack.us/img824/6830/o2v2.png After http://img5.imageshack.us/img5/2205/ksb6.png
EDIT 2: I found temporary solution.
All you need to store data using property for example:
@property (nonatomic, assign) CGRect fix_didLoadSegmentedFrame;
Then in viewDidLoad
and function where you handle value changing UISegmentedControl
you should add line:
self.fix_didLoadSegmentedFrame = self.mapTypeSegmentedControl.frame;
You should also set "Apply retina 3.5-inch from factor" storyboard property.
Try using this in viewDidLoad:
self.tabBarController.tabBar.translucent = NO;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With