iOS, iPad - NavigationBar appears on rotating device - ios

I have an issue with the navigation bar.
I have screen with NavBar and opened half transparent view on full screen (it covers NavBar).
Then, if I change device orientation by 180 degree (my app only, for landscape), then NavBar appears on top while animation. NavBar goes back under transparent view after animation completes.
Does somebody face the same issue?

How are you presenting the transparent view? If you are presenting it modally or using a UIPopover, both of these will be removed from the window during the rotation and then added back afterwards.
Have you perhaps tried adding the view as a subview of the window, above the navigation bar, like such?
[self.view.window insertSubview:your_view aboveSubview:self.navigationController.view];

Related

Presenting transparent modal UIViewController on iPad iOS 7

I have an iPad app which supports all orientations and has a UITabBarController managing a set of view controllers. Rotation works as expected everywhere. Keep in mind my UITabBarController is the .rootViewController of my app's UIWindow.
I now go to present a UIViewController modally from my UITabBarController. It presents well, and the status bar moves in accordance with the device's orientation. However, my UIViewController's view frame never changes (it is always in portrait dimensions, regardless of how it was presented).
This isn't an issue on iOS 8, and I thought UITabBarController would handle a modal controller on its own. Is there something I'm missing?
Bonus: ultimately this UIViewController will be transparent and reveal the app beneath it. When I try this and rotate my device, none of the regular view controllers rotate.
However, my UIViewController's view frame never changes (it is always in portrait dimensions, regardless of how it was presented).
This is expected. In iOS 7, rotation was implemented by applying a transform to the top-level view controller's view. The application of this transform does not alter the frame, which remains in portrait dimensions. In iOS 8, rotation is implemented at the window level.
Bonus: ultimately this UIViewController will be transparent and reveal the app beneath it. When I try this and rotate my device, none of the regular view controllers rotate.
The UIModalPresentationStyleFullscreen presentation style removes the presenter's view from the window while it is covered by the presented view controller. If you modify the alpha of the presented view controller's view, you'll just see black underneath.
Since UIModalPresentationStyleOverFullscreen did not exist in iOS 7, you would need to use UIModalPresentationStyleCustom with your own transition animator. Unfortunately, custom transitions with view controllers that can rotate is extremely buggy in iOS 7.

How to hide iOS tabbar and fill the space it leaves

I'm having trouble using the space left behind by my hiding a UITabBar.
I have a UITabBarController with a UINavigationController, whose root view controller just has a UIWebView. I'm using auto-layout constraints to make the webview fill the view which works fine (and fills the available space) when I hide the navigation/status bars.
However, when I hide the tab bar (using setNavigationBarHidden), the tab bar is hidden but the space it vacates isn't used up by the webview, as expected.
Searching similar questions suggest using hidesBottomBarWhenPushed before pushing the view. I don't want to have to push another VC (or have to reload the webview) when rotating the device. Others suggest to resize the frame (like https://stackoverflow.com/a/1554637/1429412 ), but I have not been able to do that successfully.
What is the best way to hide the tab bar in one orientation, but not the other, and have a view fill the space vacated by the tab bar?
Portrait screenshot, showing UIWebview with a green background behind status/nav bar and tab bar as expected: http://i.stack.imgur.com/Hzj9k.png
Landscape screenshot showing hidden status/navbar and tab bar. The webview contents have extended to the top (navbar), but not so to the bottom (tab bar). However, the webview itself (the only element with a green background) has extended down just not its contents (regardless of length): http://i.stack.imgur.com/sdk75.png
If I examine the views at runtime (using FLEX), and click the viewable content area, it shows UIWeBrowserView view with shorter 271 height. Clicking the area where the tabbar space is shows _UIWebViewScrollView with the full 320 height. In code, I can see the UIWebView's .contentSize is only 568x271. I tried various combinations of setting the frame on the webview and its subviews, without success.
Right now, without any frame resizing hacks, the code is simply:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[[self navigationController] setNavigationBarHidden:UIInterfaceOrientationIsLandscape(toInterfaceOrientation) animated:YES];
[[UIApplication sharedApplication] setStatusBarHidden:UIInterfaceOrientationIsLandscape(toInterfaceOrientation) withAnimation:UIStatusBarAnimationSlide];
self.tabBarController.tabBar.hidden = UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
I'm using xCode 6.1 for an iOS7+ project.
What should I do next? Thanks in advance for any pointers!
That is simply the way Tabbars are suppose to work, The only form of UIView that allows tab bors to be covered are modal views presentviewcontroller .... dismissviewcontroller Apple has a lot of samples just search for it.

masterViewController in UISplitViewController not shown

I have a tabbarcontroller with 3 tabs that are splitviewcontrollers.
It works fine except when:
in portrait view tap the rootview button to show the master
popover.
switch to any other tab
rotate to landscape (the masterview controller of that tab appears)
switch back to first tab and the detail view controller is in the
right position (320 px from left border) but instead the master view
I have a black screen
I enumerated the splitviewcontroller subviews but the masterview is not there.
If I rotate the device in portrait and back in landscape, the master view appears.
I try to better explain with this picture:
It seems to me that the problem might be caused by all of your UISplitViewControllers using the same delegate, probably your AppDelegate. That might cause the behavior you're seeing, since when one UISplitViewController returns false from collapseSecondaryViewController:ontoPrimaryController, they all will return false, giving you the padding on the left to make space for the masterViewController. But your UISplitViewControllers which are not active aren't showing the masterViewController, so you get a blank space, instead of what you expect.

Wrong flip transition from fullscreen view without status bar to normal view with status bar

At the start, my application shows full screen view (320x480) without status bar. After a user do some selection, the app uses +[UIView transitionFromView:toView:duration:options:completion:] to switch to normal view with status bar. Unfortunately, during transition it seems that toView has size 320x480, so part of the view is below status bar. Just after transition completes, view is resized to 320x460 (as it should be initially).
My question is how can I force the view to be resized correctly before transition.
I had a similar but not identical problem. Try the solution given here, which worked for me (basically, using setAnimationsEnabled: to disable part of the animation):
RootViewController animation transition, initial orientation is wrong

How can I stop the UIViewController auto-rotation animation from clipping my view?

In my iOS app I have a view controller in a UINavigationController. The navigation controller's nav bar and toolbar are both showing.
The view controller just has a simple background image as the view. The view controller can be rotated to any orientation. When the willAnimateRotationToInterfaceOrientation:duration: method is called, the view controller applies a transform to the view so that it appears to remain in the exact same position it was originally, with the same orientation. The toolbar and the nav bar, however, rotate to the new orientation.
So far so good. On rotations, the nav bar and toolbars rotate, the view appears to remain in the same position. The only problem is that during the rotation, the corners of the view are clipped off. It looks like the view controller is clipping the contents of the screen to a rectangle that animates from the original screen orientation to the new screen orientation.
Is there any way to stop it from clipping like that?
Try making your background image the size of the screen. So if its an iPhone make it 480 x 480.

Resources