UINavigationBar has wrong height on rotation in Action Extension - ios

I wrote a little app that includes an action extension.
Now I am struggling with a rotation issue.
In the beginning, the navigationBar looks like it should.
After I rotate the device, the navigation bar keeps its height, while the status bar disappears.
When I rotate back, the navigation bar is now 44 points hight, like it should be in landscape.
I uploaded a small project to demonstrate the problem to you. I recognized that the Dropbox action extension has the same bug.
The view controller is embedded in a UINavigationController
I assume somewhere down the path forgot to call super.
Is there any workaround to fix this?

I was experiencing a similar issue. In my case I had a UINavigationController. I was presenting a view controller from a child view controller of UINavigationController. After presentation, when I rotated the device, the height of navigation bar was screwed up.
What I did
Instead of presenting a view controller from a child view controller of UINavigationController, I presented it from the UINavigationController itself. It fixed the problem.

Related

Blank screen after dismissing UIModalPresentationCurrentContext

I know there are other questions that address this, but none of the other solutions will work for this situation.
I have a UITabBarController that contains a UINavigationController as a tab root.
I'm creating another UINavigationController, with a UIViewController as its root view controller, and presenting it modally with UIModalPresentationCurrentContext. The UINavigationController that presented this one sets definesPresentationContext to YES.
I change tabs and come back to the first tab. Then, I dismiss that UINavigationController, and the screen turns white (I think that's because the UITabBarController has a white background.)
Other questions suggest using UIModalPresentationOverCurrentContext. And, yes, that does solve the white screen issue. But I can't use that because viewWillAppear and viewDidAppear aren't called on the presenting view controller. I have code that can ONLY be run from those places. So, UIModalPresentationOverCurrentContext is a no-go.
I also can't use UIModalPresentationFullScreen or UIModalPresentationOverFullScreen because I have to display the Tab Bar while presenting modal window.
I will either have to use UIModalPresentationOverCurrentContext and somehow figure out a way to trigger viewWillAppear and viewDidAppear, or I need to use UIModalPresentationCurrentContext and fix the blank screen issue.
Can anyone offer any advice? I'm banging my head on my desk and am about to break something... >:(

UIBarButtonItems in UINavigationBar are sticking to the borders

I'm getting a weird bug since using PageMenu library. This library adds the ability to swipe between view controllers or change current view controller via UISegmentedControl (on the top).
When the view controller is a UINavigationController, all UIBarButtonItems in the navigation bar are sticking to the borders, like this :
The two items are sticking to the borders of the screen. The same thing happens with Back button after pushing to a view controller.
The bug disappear if I present a view controller modally in the app.
Does anybody has a solution for this ? Or at least a workaround to simulate "presenting a view controller modally" at app launch ?

Popover View Does Not Show Subviews

I have an iOS app that was created using storyboards with auto-layout. The View Controllers are in a navigation controller. Several steps down the navigation controller chain I have a button in VC1 that is connected to VC2 via a popover segue. When I tap the button, a popover view appears but is blank. I changed the background color of VC2 to see if the view was actually appearing. It was. No subviews were visible. I have created and recreated VC2. I have changed the sizes of the view, the subviews and the view controller. I have manually and automatically created restraints. I also created a test view controller outside of the navigation view controller. It behaved the same as the view controllers in the navigation controller.
Just to check if I was completely incompetent, I created a new project with a storyboard that had one VC. I placed a button in this VC with a popover segue to a second VC. It worked as desired. When the button was pressed a popover would appear and all subviews of the second VC would be visible. I tried placing the first VC in a navigation controller with no change. It continued to show the popover as it should. I have compared the two projects and I can't find what the problem is.
My question is this: Does anyone out there know of some hidden setting that would cause this behavior? or Any suggestions on what I'm missing here?
Well, after a whole lot of time (and even rewriting my project from scratch) I finally found the solution. Apparently, using size classes messes with popovers. To solve this solution, I turned size classes off completely. My app is iPad only so that worked for me. According to this thread: iOS8 Size-Classes and Popover Views you can also use the Any/Any size class. I was using Regular/Regular size class. I hope this helps someone.

Showing UINavigationBar not working

I have a UITabBarController inside of a UINavigationController which originally had the navbar hidden before the view when the tabs were needed, though when I try to show the navbar inside the file nothing happens and if I do it just before the transition then it appears before I have pushed between the two controllers is there a way to stop this effect and make it so that when the next ViewController loads the navbar is on it when it appears?
This is not an OS specific issue as it occurs in iOS 6 and 7
The UITabBarController class is not designed to be used as a child of a UINavigationController, which might explain why you're seeing odd behaviour. If you absolutely need a tab bar within a UINavigationController, you'll probably have to roll your own. Otherwise, make your UITabBarController the window's root view controller and populate it with navigation controllers.
Managed to work it out though gave conmulligan the credit because he gave me the idea which was to keep the navigation bar hidden and to embed the viewcontroller inside a new navigationcontroller so there was a whole new navbar

Using iOS 6 autolayout, what would be the proper way to display somthing above an UINavigationController?

In my app, i have a main view controller which sometimes brings a modal view on top of it. This modal view is a UINavigationController with a navigation bar. I want to display an image above the navigation bar, and have the navigation bar appear below the image.
I do not want to subclass anything and the app uses autolayout, i do not want a bunch of delegate callbacks and frame calculations. The view inside the navigation controller (the actual modal content) must still respond to different screen sizes correctly, such as rotation, call status bar etc. Also, no IB solutions please, these views are all managed in code.
How do i accomplish this?
I would turn off AutoLayout and place the image at the top
I don't think you can do it with your modal view being a navigation controller. I would do it by making that modal controller a UIViewController that you set up as a custom container controller. You can add an image view to the top of this controller's view and add the view of a child view controller (which would be a navigation controller) to the bottom. This would be a lot easier to do in a storyboard using container views, but it certainly can be done in code.

Resources