View Controller's Main View is sometimes under status bar, sometimes not - ios

I have a View Controller with one main image covering the whole of the view, and a few buttons. When I get to this view through a push segue from the previous controller, the view is shifted downwards below the status bar, showing a black strip where the view is missing (and moving my buttons out of position).
When I show the next screen and dismiss it, the view shifts back to the correct position.
How can I make sure that the correct distribution of the view (second image) happens every time?
UPDATE:
This is how my storyboard looks:

I was able to fix this problem with a simple line of code:
self.automaticallyAdjustsScrollViewInsets = false
By the way, this was happening to me on a UIPageViewController and this line of code was included in ViewDidLoad of that VC, not the Content View Controller.

Related

How to fix incorrect (small) view on my main storyboard

So In my main storyboard one of my view controllers view is smaller than it should be, making that part of the UIView untouchable to the users... I don't know if its a tool bar or some weird inherited view from the previous view controller as it does have a relationship to the previous view controller
tried removing tool bar, I even put my tableview over top of the view making it bigger, but it is unusable on the iPhone after the build
I just need it removed, its a grey bar
I am going to assume that gray is being passed over to your present view controller, I would remove the segue to check if the view updates its constraints, if so remove the previous view controller and embed it to the previous to remove the bar

Animation bug with always displayed large titles after popping view controller

I wanted to use the new Large Titles with largeTitleDisplayMode set to .always but got some strange animation issues while popping the pushed detail controller if the root UITableView's contentOffset.y is positive aka scrolled.
So this is how it should work:
And this is how it works after scrolling:
I guess it's a bug, but maybe anyone have a workaround till it's fixed?
To reproduce, create a new sample project, open Storyboard and do the following:
Add Navigation Controller and tick it's Navigation Bar's Prefers Large Titles value
Select it's Root View Controller and set it's Table View's Content to Static Cells.
Add many static cells or make then big enough, so your Table View become scrollable
Add a View Controller as detail view controller and setup the Show segues
Setup the Navigation Item's Large Titles property to Always for both view controller
Run the app, scroll to the bottom, perform a show/push segue and pop back

UIStoryboardSegue Modal Form Sheet fills entire screen at first

In my iPad storyboard, I have a + button in my nav bar which should bring up a new view controller in a Modal Form Sheet (image 1). However, the View Controller ends up filling the ENTIRE screen at first (image 2). If I tap one of the UITextfields in the new view controller, then when the keyboard comes into view the view controller finally resizes down to the Form Sheet and displays correctly (image 3).
It only happens when in Portrait orientation. In landscape, everything works fine.
How do I fix this?
Here is my segue configuration:
This is NOT a duplicate of iPad modal form sheet takes up the whole screen anyways, because his problem is while presenting via code and was able to change his code to fix the problem. I've got a Storyboard segue attached to a UIBarButtonItem and so I only have control via the Storyboard.
I have no idea why this seems to work... but my problems went away when I embedded my view controller in a UINavigationController with the nav bar visible. (At first, I had the nav bar hidden and it was still broken. When I made the nav bar visible, then it was correctly sized in both orientations.)

UITableViewContent Inset messed up on iOS 8

I have a navigation controller with a UITabBarController as the initial view controller. Within that, I have two UIViewController's as sub-viewcontrollers in the tab bar controller. Both of my view controllers have UITableView's in them. The first one always looks fine. However, the second view controller always has a messed up content inset. I don't know why because there doesn't seem to be any difference in the way I setup my table views. I can manually set the content inset in viewDidLoad, but there's got to be a better way since it's working by default in the first view controller.
This is the first table view. As you can see, the the content offset looks fine.
Something to note: when opaque navigation bars are turned off, the issue goes away.
This is the second table view. As you can see there is a table view cell underneath the navigation bar.
I fixed the issue by changing the structure of my view hierarchy. Apparently I should not of had a UINavigationController as the initial view controller, but rather had the UITabBarController as the initial view controller and from there have UINavigationControllers within the tab bar where needed.

When animating a viewController on top, the one in the back disappears.

I have a viewController which displays a map with annotations. When I click on a bar button, another viewController is supposed to animate on top of that. This works, BUT, when the animation completes, the viewController in the back disappears. It reappears again when the animated viewController closes again.
Here is a video of what happens - hopefully that will make things more clear:
Let me know if I should include the code as well.
When you present a view controller it is expected to take the full screen. As such, the view controllers 'below' it have their views removed from the stack to save resources which are expected to not be required.
You can change your presented view controller to do something like:
Either, don't be presented, just add a subview and animate it in.
Or, pass an image of the original view to the presented view, this becomes the background and that presented view animates a subview in over the image background.

Resources