Modal view gets moved to the back when autorotating with MGSplitViewController in iOS 5.x - ios

I've successfully implemented MGSplitViewController in my application and it seems to work pretty well but in iOS 5.x, it has this weird issue.
I start my app with its MGSplitViewController as the root view controller in Portrait.
Trigger my full screen modal view controller that gets displayed over top successfully.
Rotate device to Landscape and the view disappears but there's a piece of it still showing through the split view slider.
Has anyone seen this and/or fixed it? It works just fine in iOS 6.
If I rotate the view back or try to open other modal views, nothing happens. It's like that modal view is stuck behind.
Note: This is how I setup my MGSplitViewController: Known effort to update MGSplitViewController for iOS5 and Storyboards?

Ok well I figured out what the problem was.
I was presenting my modal views (and segues) from the tab Controller or the detail view controller and the modal views (and global modal segues) needed to be presented from the MGSplitViewController instead.
When I was using UISplitviewController, I had been able to present the modal views/segues from that controller but when I switched to MGSplitViewController, it was not represented in the storyboard so I tried setting global modal segues (such as login) to the tab bar controller which is the master controller. This seemed to cause the issue.
For modal views, I ended up presenting them from the MGSplitViewController and I had to remove the segue I had and simply present any modal view controllers I had previously segued directly from the MGSplitViewController instead.

Related

Popover View Does Not Show Subviews

I have an iOS app that was created using storyboards with auto-layout. The View Controllers are in a navigation controller. Several steps down the navigation controller chain I have a button in VC1 that is connected to VC2 via a popover segue. When I tap the button, a popover view appears but is blank. I changed the background color of VC2 to see if the view was actually appearing. It was. No subviews were visible. I have created and recreated VC2. I have changed the sizes of the view, the subviews and the view controller. I have manually and automatically created restraints. I also created a test view controller outside of the navigation view controller. It behaved the same as the view controllers in the navigation controller.
Just to check if I was completely incompetent, I created a new project with a storyboard that had one VC. I placed a button in this VC with a popover segue to a second VC. It worked as desired. When the button was pressed a popover would appear and all subviews of the second VC would be visible. I tried placing the first VC in a navigation controller with no change. It continued to show the popover as it should. I have compared the two projects and I can't find what the problem is.
My question is this: Does anyone out there know of some hidden setting that would cause this behavior? or Any suggestions on what I'm missing here?
Well, after a whole lot of time (and even rewriting my project from scratch) I finally found the solution. Apparently, using size classes messes with popovers. To solve this solution, I turned size classes off completely. My app is iPad only so that worked for me. According to this thread: iOS8 Size-Classes and Popover Views you can also use the Any/Any size class. I was using Regular/Regular size class. I hope this helps someone.

View appears with modal view animation instead of show (push) animation

I've recently updated my app from iOS 8.3 to iOS 9.
After fixing the various errors with the code, I managed to compile the app and run it, when I noticed the following problem.
When I perform a segue clicking, for example, an UIButton, the view loaded with the segue appear with the animation of a modal view (sliding from bottom until it reaches top), but in the storyboard the segue is Show (e.g. Push). In addition, the back button from the navigation controller doesn't appear anymore.
The console print this when I perform a segue:
Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x7ffde14866b0>)
The problem seems to be present only in a view, when loading other views, I tried to set other views as Initial View Controller and all works.
After taking a look at the Storyboard in the project, I discovered that the problem was due to extra navigation controllers after each Push segue. That is, in addition to the initial (root) navigation controller, the Storyboard contained a UINavigationController as the destination for the problematic Push segues. Removing these extra navigation controllers (but keeping the root navigation controller) solved the problem.

QLPreviewController loses touch after presenting a modal view controller over it

In an iPad master-detail application (the master is an UITableViewController and the detail a QLPreviewController) whenever I present a view controller modally and then dismiss it, the QLPreviewController stops receiving touch events or at least reacting to them. So, it's no longer possible to zoom in or out, or "bouncing" an image/document currently being shown, even after another image/document is selected and shown.
Keep in mind that before presenting the view controller modally everything works as expected and it's possible to zoom in/out.
Anyone knows a possible solution for this weird problem?
EDIT: added that this happens after dismissing the view controller presented modally.
EDIT 2: if the presentation style is UIModalPresentationFormSheet, the problem does not occur. It seems to only occur with UIModalPresentationFullScreen.
Although not a solution for this problem, a workaround is to present the view controller as UIModalPresentationFormSheet instead of fullscreen.
Yes that is expected behaviour.
When a ViewController is presented modally (I assume you are presenting something in a form sheet?), it prevents other view controllers receiving touch events.
The other alternative is to have a look at child view controllers as an alternative; but again, their touch events will take precedence over anything underneath.

'Show' segue in Xcode 6 presents the viewcontroller as a modal in iOS 7

I have two view controllers in my iPhone application (built with swift) built with Xcode 6.1 and uses storyboards.
The first view controller is embedded in a navigation controller in the storyboard and the segue for the second view controller is a 'Show' segue.
When the application is run, it properly shows the transition as a push in iOS 8.x, but in iOS 7.x it appears as a modal without the navigation bar.
My application requirement is to show the transition as a push regardless of whether it's iOS 7 or iOS 8. Any ideas to get this working as push in both versions of the iOS?
I saw a related post where this issue is mentioned, but could not find a solution to the problem: Adaptive segue in storyboard Xcode 6. Is push deprecated?
Any help is appreciated...
Thanks
This solution is different from the others in the following ways:
It includes a method to examine and verify the issue
The cause of the issue is traced to the source (a change in the segue type)
The solution is very simple (delete and recreate a new segue)
Please note the requirements in the text
I just gave a very detailed SO answer that fully explains what is happening and why, but the simple solution is you can delete the Segue that is not pushing and then recreate it on the storyboard. The reason is that there is likely a broken bit of xml in the segue (see extended answer for example/instructions how to confirm this issue).
After you confirm that you have at least one UINavigationController within the view hierarchy, be sure that the segue is NOT a manual segue and does NOT have an action associated with it (by viewing the segue in the storyboard as Source Code). Delete the existing segue and then Ctrl-drag from a UIView/UIControl to the target view controller and if custom action is needed intercept the call to destination controller in prepareForSegue.
Also to confirm that this solution works for you please do the
following:
Verify that your initial view controller (with the arrow on it) is a
UINavigationController and that it has a normal content view
controller as it's root view controller. (or that you embed your
initial view controller inside of a UINavigationController)
Read my extended comments on an earlier response to a very similar question (linked above).
It's possible that you have assigned the Initial View Controller to your UIViewController instead of the UINavigationController. Also, select your UIViewController and check that the "Is Initial View Controller" option is unchecked.
Here is the workaround for that. It looks like a bug in Xcode for iOS 7. You need to create a dummy UINavigationController and link all your free UIViewControllers to this navigation controller. Worked for me.
For me, my storyboard lacked a navigation controller. I am creating the navigation controller programmatically, which works fine in iOS8, but not iOS7.
SOLUTION
In your storyboard, select the main view controller and in the Xcode menu, choose Editor > Embed In > Navigation Controller.
Select the new navigation controller, and in the attributes inspector on the right, under View Controller, make sure Is Initial View Controller is checked.
Run the app. Should be fixed now.
I believe this is a bug in Xcode 7.2. In order to workaround, you can create a "Push (deprecated)" segue and then in the Storyboard editor, select the segue and change it to Show(e.g. Push)
I have had this exact issue with "Show (eg. Push)" for ages and I have just figured it out whilst trying to push a view controller onto a navigation controller that is in a Popover. It seems that the context of the called View Controller is the problem. So this is how I resolved it:
On the View Controller performing the Segue, check the "Defines Context" property in the Storyboard.
In the called View Controller, set the Presentation property to "Current Context".
I ran into this problem and the only solution I found that works for me is to use the deprecated 'Push' segue.
I am using XCode 9 with Swift 4. Note this version came out yesterday (September 20th).
For me this was just a caching bug. I had to choose "Present Modally", run the app and then choose "Show (e.g. Push)". Now everything works fine.
Basically the answer of Jomafer is partly correct. The controller which you are pushing needs to be preceded by a UINavigationController. You dont really need to push the UINavigationController at all. As long the storyboard knows its within a UINavigationController, all is well.
When a "Show" segue comes up as a modal segue in testing it is usually one of two problems:
The first view controller is not inside a navigation controller.
The storyboard XML is corrupted.
The solution to #2 is usually to remove and replace the segue, and it should correct itself. Sometimes just switching to some other presentation style, running, and switching back to "Show" fixes it.
This can also happen to "Show Detail" segues, and it can be more insidious.
Example:
I have a series of view controllers arranged in a UISplitViewController. They have segues Show->Show->Show->Show Detail. The last segue kept coming up modal. I tried everything to fix that last segue. The problem was that the upstream Show segue had been corrupted into a Show Detail segue (even though the storyboard still said it was a Show segue). I had been testing on iPhone, and I did not discover the real problem until I ran it on the iPad simulator. The segues were now Show->Show->Show Detail->Show Detail. On the iPhone the third segue looked just like a Show because it collapsed onto the navigation controller. However, it is still the detail view controller, and you cannot have a Show Detail from a detail view controller, so the OS does what it can to get your view controller on screen and displays it modally.
Lesson 1: Always test your UISplitViewController on iPad to make sure the segues are doing what you think.
Lesson 2: If your segue is coming up modal unexpectedly, check the upstream segues for corruption as well as the segue in question.
Problem in my case was that I created Show (e.g. Push) segue before putting ViewController as rootViewController of UINavigationController. In other words I didn't have UINavigationController.
Then I deleted seque, added UINavigationController and added seque again and it worked. Tested on Xcode 9.0.1 / iOS 11.0.3.

iPhone popover controller present view controller fullscreen

I am using a third party popover controller on the iphone and have ran across an issue. The one I'm using is WYPopoverController but have tried using FPPopover and it has the same "issue" since they work in a similar way. Here is the deal:
I have a notifications button in my app which pops up a popover controller which contains the notifications feed. It's like the Facebook app. You can see it on the below image.
Now what I want to do it so present a view controller on top of everything and in full screen. The way that popover controller works is that it ads its view directly to the applications main window and its not nested in the view hierarchy so I get a warning saying presenting view controllers on detached view controllers is discouraged and it does not present full screen as well (I know thats logical). If I present it on the parent view controller (the red one in the background) it gets presented below the popover view.
How to fix this?
I was thinking about using a new UIWindow instance and using a root view controller there. Is this an OK solution or is it a hack? If it's ok then how do I accomplish this? I want the presentation and dismissal to be animated :)
I want it to look like Facebok Paper app when you tap an item in the notifications feed.

Resources