ios - UINavigationController barstyle property changes layout -
I have a modal view controller that displays a navigation controller in the navigation controller in turn as a regular UIViewController The root view is the controller. Only UI element which has a UISwitch near the above UIViewController
Now here's the problem: When I change the barStyle property of the Navigation Controller, the layout of UISwitch inside the UIViewController changes Here's what I'm talking about:
If I do not set barstyle property, here's what I get:
UISWet now has its own 'Exepected' place
Now if I set the barStyle property,
navController.navigationBar.barStyle = UIBarStyleBlackTranslucent; Note that UISwitch is behind the navigation bar:
There is a code for UISwitch in UIViewController:
- (zero) viewDidoad {UISwitch * mySwitch = [[UISwitch alloc] initWithFrame: CGRectMake (20, 20, 100, 100)]; [Self.view addSubview: mySwitch]; [MySwitch release]; } Does anyone help me understand what is happening?
When you use the UIBarStyleBlackTranslucent property (which is actually deprecated) Believe that you want to keep your view down
UIBarStyleBlackTranslucent asks you to use it:
New Controller navigation bar. Barstyle = UIBarStyleBlack; NavController.navigationBar.translucent = Yes; You can try moving your view back to the right place or try using the following:
navController.navigationBar .tintColor = [UIColor blackColor]; NavController.navigationBar.translucent = Yes;
Comments
Post a Comment