UINavigationBar cutting the height of status bar - ios

In iOS8, I have a root view controller where I would show another navigation view controller as the root vc's subview when user clicks on one button. I pre-loaded the navigation view controller in viewDidAppear to ensure responsiveness when user clicks on the button, since instantiating and adding subview would cause some latency.
However, if I put the setupNavigationVC() inside viewDidAppear(), my navigation bar would look like this when expanded to full screen.
if I let my code execute setupNavigationVC() right after user clicks the button, the navigation bar would look normal.
Also, I noticed that if I pause the app and then go back in. The navigation bar would return to normal. I suppose the OS must have reloaded every view when an app is resumed.
Thanks in advance!

Related

View Controller with Embedded Navigation Controller linked to tableview

Mainly, my iphone application right now is a UIviewController with navigation buttons, logo, and title on the top of the screen. Inside this controller is a container view, which has an embedded navigation controller which leads to a series of table views that the user can navigate through. On the parent view, there is a back button that causes the inner navigaion controller to call popViewController and also updates the title of the screen on the outer view. This all works correctly, but when the user clicks the back button quickly, the naviagtion controller will already be in motion and “pop” again, but the title will update, causing the pages to become out of sync.
I have tried to block the back button and even used completion handlers, but nothing seems to work. Is there really no way for me to be able to prevent the back button from being clicked while the inner navigation controller is busy?

Launch a viewcontroller in a stack of tabbar controller from background (iOS-Swift)

I have a storyboard with tab bar controller and one of the tabs segue to another view controller and so on as show in the picture.
I want to go to the page (3) programmatically in the stack while maintaining the stack of the tab bar controller .
Thanks in advance..enter image description here
This one's a little tricky, maybe someone else here knows a better way of doing it but here's how I would tackle the problem. Let's assume for simplicity that all views are loaded already. Let me know if this works
Setup an observer in the view controller that is being displayed by the tab selected in the tab bar controller. (Let's call this page TabPageVC). When the event that the TabPageVC is observing is fired have it segue way to page 3 immediately
In app delegate when the app becomes active / enters foreground check to see if you need to display page 3. If you do need to then get the root view controller in app delegate (i'm assuming it's the tab bar view controller, if it's not you'll need to set it to be).
Set the selected tab in the tab bar controller to be the tab of the index that TabPageVC lives in
Trigger that event that TabBarVC is observing this will cause TabBarVC to immediately segue way to page 3 and you'll have retained the stack

Why is tab bar not displayed correctly after being pushed animatedly from another view?

I am pushing a tab bar controller into using a standard animated push segue on iOS 8, but here is what happens:
See the tab bar, it's cut halfway. If I invalidate layout using setNeedsLayout, layoutSubviews etc nothing works (I've even tried dispatching it after 2 seconds after view appears). If I tap home button and then come back, it re-layouts and displays correctly. This happens only the the segue is animated, if I make the same segue non-animated, the problem doesn't occur. How can I get rid of this behavior?

Swift - create a back button without navigation controller

I have an app that has a toolbar, but I don't want the bar at the top, in order to free more viewing space. Therefore I have decided not to use a navigation controller. I'd like to add a back button to the toolbar. How would I go about this?
Adding the button is easy enough, and setting the action to performSegueWithIdentifier is all fine, but what happens is that the previous view just gets loaded again, rather than show it as it was, like a true back button. So if I tap on the 10th row on a tableView and go to a new page, when I press the back button it loads the view from the top again, instead of showing it as where I scrolled down to last.
Even though you don't want a UINavigationBar, you do want a UINavigationController in this case, because it manages the 'back stack' exactly the way you want it. Just hide its navigation bar by setting its navigationBarHidden property to true (in the Storyboard or in the viewDidLoad function of the root view controller).
You can then use navigationController.popViewController(true) as normal, in response to the user clicking your custom back button.

Stop UIViewController Animation on dismiss

I have a UIViewController that I display full screen, then when the user touches a button I present another view controller like so:
[self.navigationController pushViewController:loadSaveViewController animated:YES];
I like the animation that happens when I transition TO the view controller i.e. the main view shifts down and slides off to the left and the new view controller is displayed with the nav bar at the top.
HOWEVER, when I go back using the button at the top of the nav bar the screen does the opposite. The main screen appears, but with a nav bar at the top for a short time then the main screen shifts up.
How do I stop the main screen from doing the animation? When the user returns to the main screen, I do not want them to see the nav bar and the shift up, I just want the main screen to appear, or slide in.
Thanks for the help.
In iOS 7, there are new classes that will allow you to control every aspect of animation. This website is very useful ios 7 transitioning

Resources