UIViewController, displayed modally, dismisses itself upon device rotation - ios

I've got a UIViewController that I'm using as a login view that's displayed modally above a UISplitViewController. Once the user has successfully logged in, the modal view is dismissed. The master view controller in the split view controller has a left bar button item to logging out. Once the logout button is tapped the login view controller is displayed modally again. If the user rotates the devices at this time, the modal login view is being dismissed.
I have no idea how to catch this. When setting a breakpoint on viewWillDissappear on the login view controller only system API's are being called - nothing I wrote.
A sample app that reproduces the problem can be found here: http://d.pr/f/c6oG
Steps to Reproduce: Launch the attached app in portrait mode. Tap the login button. Tap the master button. Tap logout. Rotate the device left or right. The modal view dismisses.
Expected Results: Launch the attached app in portrait mode. Tap the login button. Tap the master button. Tap logout. Rotate the device left or right. The modal view doesn't dismiss.
Actual Results: The modal view dismisses upon device rotation after completing the steps to reproduce above.
I've also filled a radar bug #12585564.
Any ideas? Thanks in advance!

You need to present the login view controller from the split view controller, not the master or detail view controllers.

Although it's not exactly what I was looking for, I ended up overriding splitViewController:shouldHideViewController:inOrientation: in the DetailViewController. After that, the issue does not happen.
I do like the look of the master view controller staying on screen when the device rotates - similar to the Settings app.

Related

iOS modal interactive dismissal freezes

I have created a UIPercentDriven Transition which modally presents a popover view containing a tableView. Then, following stack exchange posts such as this one: In iOS, how to drag down to dismiss a modal?, I added a panGestureRecognizer to control the dismissal of the modal view. Then, I attempted to add functionality so that the user can continue to swipe downward once the tableview has reached the top to trigger the percent driven transition.
Here is a link to the project on github:https://github.com/KaplanAlex/modalViewDismissal
This transition was based on moving the frame of the modal view off of the screen. I also created the transition by using snapshots (which is commented out in the github project) and have the same issues. For some reason, the interactive dismissal works well unless the user moves the modal view back up after starting the dismissal and then continues to swipe upward after the modal view has reached the top of the view, the entire application seems to freeze. It doesnt crash, but also doesnt respond to taps anywhere on the screen. Even cancel button cannot be pressed. Has anyone encountered this issue before? Thanks for the help.

What happens to a View Controller after it has modally presented another View Controller

Consider the following structure of an app:
Login Screen --> Splash Screen --> Main use (--> Logout page --> New Instance of Login Screen)
When the user logs in from the Splash Screen, I present the Splash Screen Modally from the Login Screen. When the Splash Screen have completed it's tasks, I present the Main Use View (Which is a UITabController) modally from the Splash Screen. If at some point the user decides to logout of the app, I remove the credentials and present a new Instance of the Login Screen modally from the Main Use View.
I recently started doubting that this works as I expect it to. Say that the user have navigated all the way to Main Use, are the presenting View Controller (Splash Screen) and it's presenting View Controller (Login Screen) still active and present in the Hierarchy? After Modally presenting another View Controller, I expect the first View Controller to be completely unloaded and forgotten by the System, as if it was set to null. Can someone confirm this? And in case this doesn't work as I expect it to, what should I do instead of modally presenting View Controllers?
Your doubts are warranted. When you present a modal view controller, it goes on top of the existing view controller and covers it, but the existing view controller does not go away. You never want to present a new copy of a view controller without dismissing the previous one.
(Using dismiss(animated:completion:).)

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?

Change presenting viewcontroller

Heyo,
Right now I've got an app that presents a menu screen that partially covers the original screen, and can be used to navigate to other screens. This is done using a modal segue.
To get to another screen the from the base page the menu is presented, the user selects the next screen in the menu, the menu is dismissed, and THEN the segue to the next screen is preformed.
What I've spent a few weeks trying to figure out, however, is how to dismiss this menu DIRECTLY to a viewcontroller OTHER than the one that's presenting it.
I'm thinking I've got to figure out how to change a presenting view, but I haven't had any luck.
Currently I'm completely at a loss, and any recommendations/fixes would be great!

Is it mandatory to dismiss a view when it is presented in ios?

I am working on iPad App.
Here I am having different views with different orientations. Among them I am PRESENTING a view on clicking button.
While I am DISMISSING that view i am facing orientation problem.
So, to clear that issue i changed the rootviewcontroller after pressing done button where it was dismissed previously.
By doing this my issue was cleared and now not facing any orientation issue.
But what my doubt is does it reaches Apple standards?
Should we dismiss the view if it was presented? Or
should I load the view with any animation effect? Good suggestions appreciated.

Resources