UIStoryboardSegue Modal Form Sheet fills entire screen at first - ios

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.)

Related

xcode and iPhone simulations show weird top grey bar behind views after navigation, how to remove them?

I am trying to update an old Storyboard and viewControllers. in Interface Builder, my viewControllers has the following grey bar that I do not know how and why they are appearing, they were not there previously:
These are also visible when I try to simulate my apps in the iPhone simulator as follow:
When I start my app, the views are stretched with a tiny view of this space as follow:
However, when I start navigating to other viewControllers the space is visible as shown in the previous screenshot.
Any idea of how to stretch my views all the way to cover these areas?
I am currently using swift. The navigation is being done using Storyboard Segue.
Thank you.
This is just the storyboard showing the way the screen will be presented, that grey bar represents the view that will be behind that view controller. This kind of presentation is called modal (page sheet or form sheet) the two have different effects on iPad
Code Fix
To fix this, change the modalPresentationStyle to overCurrentContext on the view controller you're going to present. So in code do viewControllerToPresent.modalPresentationStyle = .overCurrentContext
Storyboard Fix
in storyboard select the segue (the line linking the two screens) and then on the far right menu select the item 3rd in from the right, you should see a section called presentation, change it to Current Context.

Changing tabs on Tab Based Application Pushes UI Elements Down

I have a tabbed based iOS application. The fourth tab is linked to a UINavigationController. When I navigate to the home tab from the fourth tab, the UI elements of the home tab are pushed down. However, if I rotate the phone to landscape and then back to portrait, everything has moved up and is in the correct place.
In Storyboard, I set the top bar to none. I have the UINavigationBar hidden in the fourth tab/view controller before I navigate to the home tab.
Why would it be that the rotation fixes the constraints? How can I fix the UI elements such that they are not pushed down in the first place?
Here is a screen shot of my storyboard:
Your question doesn't really make sense. A 4th tab would not be embedded in a navigation controller. Instead, the 4th tab would link to a navigation controller. When you first select that tab you'd see the root view controller and it's navigation bar item. If you pushed a new view controller it would get pushed onto the navigation controller in tab 4. If you switch to one of the other tabs then the navigation controller will be swapped away and it's navigation bar will no longer be visible. Swap back to tab 4 you'll see it again, complete with it's navigation bar.
I created a sample app in order to confirm what I'm describing, as I haven't used tab bar controllers a lot, and not in quite a while I can upload the project if you really need to see it. It only contains a couple of lines of code (to implement the button on the navigation controller's view controller that creates and pushes a new view controller.)

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

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.

iOS app ScrollView not working when segue changed from Show (Push) to Present Modally

I have a tableviewcell, on clicking which the app navigates to a new storyboard. The storyboard has a scrollView to display images and a page control at the bottom. The segue to this storyboard was configured as a Show (Push). Now, I am trying to switch the segue kind to Present Modally. In the app now when I touch the tableviewcell, the modal pops up as expected (cover vertical), but none of the images are displayed. A blank screen gets displayed with the page control at the bottom. Is there something I am missing?

Slide viewController in navigation controller

I'd like to use a slide up / down effect to display various viewControllers inside a navigation controller. A few other apps do this like square, and every day. Basically when the app loads, I want to display a base view in the navigation controller. Then slide up another view controller over top of it. When then hit a button in the nav bar, I want to slide that down and show the base controller, all the while retaining the navigation bar, and changing up nav items.
Originally I tried to make this work by showing a modal but that requires using a new nav bar.
Has anyone done this, or knows of a good example that illustrates this UI pattern? Thank you!
You could have UIViews in a UIScrollView

Resources