I am testing my application on ios7 os iphone.In that am going from portrait viewcontroller to landscape viewcontroller.before going to landscape view my navigation bar height is 44 pixel.but coming from landscape view its height is reduce to landscape view navigation bar.I checked all orienation code.Please help me to solve this.
try this inside didFinishLaunchingWithOptions method
self.window.rootViewController = self.viewController;
Related
I am creating an app that is exclusively in portrait mode, except in one view. It switches to landscape fine, but when using the "back" button to go to the previous view, which should be displayed in portrait, it now is displayed in landscape.
How can I force the UIViewController to be presented in portrait even if the previous controller was landscape?
The following code is no longer working as it was deprecated...
UIViewController *c = [[UIViewController alloc]init];
[self presentModalViewController:c animated:NO];
[self dismissModalViewControllerAnimated:NO];
Based on status bar orientation you can change the device orientation. After clicks the back button check the orientation of device and based on that set the orientation.
What is the best way to show a UIViewController only when the device is on landscape mode?
The modal view controller should present itself modally when the device is on landscape mode and should dismiss itself when going back to portrait.
Since - (BOOL)shouldAutorotateToInterfaceOrientation :(UIInterfaceOrientation)toInterfaceOrientation is only called once (and not for every UIViewController), how should the navigation controller be set up?
The method you're looking for is
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)o duration:(NSTimeInterval)t;
When I switch my iPAD to portrait mode the navigation bar buttons button appears correctly. Now If i choose a table row from popOver View and push a new screen for the master and detail view the navigation bar button disappears and wont appear until I rotate the device to Landscape and then back to Portrait. Does anyone have a idea how to fix this ?
Perhaps you are not setting the delegate in the UISplitViewController
self.delegate = secondViewController;
I have a UITabBar with 2 bar items. The initial orientation of the device is portrait. If I rotate the device to landscape while being at tabBarItem2 the whole thing(Status Bar, TabBar, ViewContent2) rotates fine, but when I press the tabBarItem1 the ViewContent1 is still in Portrait. It also happens if I'm in tabBarItem1, then rotate device to landscape and I go to tabBarItem2.
I'm using the willRotateToInterfaceOrientation method on each view controller to move things.
I think this is happening because it is triggering the actual viewController's willRotateToInterfaceOrientation method and not on both of them.
Any ideas on how to fix that?
Both view controllers need to have
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
I have an application which is focused around a bunch of viewControllers in portraitmode, but on a specific detail view i need to open another view if the device is rotated to landscape mode.
So the user will look at the information view in portraitmode and if the user then rotates the device to landscapemode then a new view is displayed with additional information. If the user rotates back to portrait then the added view needs to be removed so the "original" detailview is visible.
It's important that the "original" detailview is not rotated to landscape - Only open a new view in landscape mode.
I've tried using shouldAutorotateToInterfaceOrientation: and managed to have it open a viewController, but it's not being shown in landscape view so it looks all messed up plus I'm having some trouble getting the view to disappear when i rotate back to portraitmode.
How do i do this?
Check if the orientation has changed using the View controllers did change orientation methods and if its rotated to landscape add ur landscape view and when the device is rotated to portrait remove the view from the view controller's view.
in shouldAutorotateToInterfaceOrientation
if(UIInterfaceOrientation == UIInterfaceOrientationPortrait){
NewView *newViewController = [[NewView alloc]initWithNib:#"NewView" bundle:nil];
[self.navigationController pushViewController:newViewController animated:NO];
}
you can repeat this for all the other orientations as well.
Using shouldAutoRotate didn't work since the view that gets opened will be opened in portraitmode and not landscape.
I ended up with a solution using beginGeneratingDeviceOrientationNotifications and shouldAutoRotate in the subview.