Blank screen after dismissing UIModalPresentationCurrentContext - ios

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... >:(

Related

Pushing view onto navigation controller in tab bar controller does not animate

I have a very peculiar problem.
My setup is a UITabBarController with two UINavigationController -> UICollectionViewController children.
If I say navigationController.pushViewController(someVC, animated: true) in viewDidAppear, the view controller is pushed as expected.
However, if I say navigationController.pushViewController(someVC, animated: true) when a cell from the collectionView is tapped, the view controller appears, but there is no animation/interactivity when going back (I cannot slide, and the buy button makes the controller instantly disappear).
This is really frustrating because I can think of no explanation. Why would the animations and interactivity work when pushed from viewDidAppear but not when pushed from a different function?
Why on earth is this happening, and how can I fix or get around it?
Well I have not figured out what is causing this issue, but I did find a (rather inconvenient) solution: Set the tab bar items in viewDidAppear. Use a short splash screen or something until then.
I'm not sure what the original problem was, though, so it would be great if anyone else had any explanations!

UINavigationBar has wrong height on rotation in Action Extension

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.

Programming Transition Loses Navigation Bar

I'm having an issue with my main.storyboard file. I changed the settings of my app so that the start screen is the main.storyboard file, rather than LaunchScreen.xib. The initial ViewController is the NavigationController, and the second is my SplashScreeViewController. (I created my own splash screen in the storyboard so that I could change it with additional code.) I use a line of code in my splash screen to later transition to the second view controller. Here it is:
var controller:UIViewController = self.storyboard?.instantiateViewControllerWithIdentifier("Second") as! ViewController
controller.modalTransitionStyle = .CrossDissolve
self.presentViewController(controller, animated: true, completion: nil)
For some reason, when I transition to that second ViewController, the navigation bar that should be at the top (of the second ViewController) isn't there, opposite of what was shown in the main.storyboard file. I tried to add an invisible, disabled button to the splash screen as to add a connection between the two view controllers, and therefore adding a navigation bar to the second, but when the splash transitions on its own, no navigation bar appears on the second.
Is there a way I could have a navigation bar on my second view controller without dragging one in, nor programming it in? I would like to use the one Xcode provides when you create a new connection between controllers.
Thanks in advance to all who reply.
*(I apologize for the lack of pictures to help describe my problem. I don't have enough 'reputation' to do so.)
You need to embed your Second view controller on a Navigation Controller, and then instantiate that navigation controller instead.
This might solve the problem - It looks like you are presenting a modal view controller when you probably want to be pushing your view controller from your initial navigation controller with pushViewController

TabBarController in NavigationController does not show TabBar in viewControllers

I have a UITabBarController to whose controllers I would like to attach navigation. So I inserted the NavigationController as the entry controller, and the tabBarController as its root. All seems working fine, but for the tabBar. Basically it does not show, albeit the StoryBoard I attach seems to say differently. I also attach the Account Screen not showing any navigation bar nor, of course, any back button.
Thanks,
Fabrizio
Just a quick answer. I think you should put UINavigationController inside the TabBarController instead of the other way round. It will solve most of your problems.
Steps: Editor -> Embed in -> Navigation Controller
See the below screen shot on how to add a Navigation Controller to a View Controller.
You are following wrong approach, IOS does not allow you to use tabbarview controller as root of navigation controller, it always display black screen. I have faced same problem and as a solution i have added navigation bar after tabbar controller. Yes it becomes difficult to manage, but you can use that way and it will work.
If you use programmatic approach instead of storyboard then it is possible, see this link
Even you can try from Editor option of XCODE, select tabbar controller you have added from storyboad then go to Editor->Embedded in, you will see that navigation bar controller is disable.
This is also give you idea that it will not work.

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

Resources