I have a simple structure hooked up in Storyboard. I want to transition from one scene to another using a Modal transition. The scene where I am transitioning to is smaller then the current scene. So I want the "bounds" of the current scene to be visible behind the modal view.
But when I transition, and the transition is completed, the source view controller is removed from screen. Leaving black surroundings behind.
I have made a short video with the problem. Which can be found here. How can I make it so with the segue that the source view controller stays on screen?
Well, found the solution. In those duplicates people state it cannot be done except when you use a screenshot as "background".
But setting this:
source.modalPresentationStyle = UIModalPresentationCurrentContext;
on the source controller seems to work. Then it does not disappear.
Related
Push segue transition animation is somewhat choppy
<- The explanation of the issue in that post states my issue exactly:
"I am using push segue with default animation for transitions on the navigation controller. However, the animation seems to be somewhat choppy. While pushing a new view controller, source view controller shifts left and hangs halfway through. And a moment after this, destination view controller appears."
The storyboard I have is almost like this...
...with the following exception: my master view is a UIViewController consisting of 2 container views, both containing UITableViewControllers, both dynamic tables. Selection from one of the tables pushes the detail view onto the stack (same as the storyboard example above). That push is the "choppy" animation
Like the OP's issue, the master view is shifting left behind the semi-transparent detail view that is shifting into view from the right side of the screen. When the detail view is fully in view, approx half of the master is still in view behind the detail view momentarily, and then it disappears.
All other transitions (push, pop, modals, dismisses, etc) are smooth. This applies only to devices that cannot display both of the split views at the same time, so no iPads.
I also recently had this problem using a Master Detail storyboard with an embedded Navigation Controller. The choppy animation of the segue may have started when I changed the global tint but did not resolve when I changed to back. The issue was fixed when I changed the Background of the View of the Detail screen from Default to a different color. I found it did not make any difference which color as long as it was not Default.
Be sure your UI updates are in the main thread and if the code is already on the main queue then if you using dispatch_async may only going to have overhead. Especially in your prepareForSegue method or in the viewWillAppear there shouldn't be heavy pieces of code (that should stay in the background thread) in main thread that causing this kind of things.
I have a problem with a transition. I am modifying this project https://github.com/xxxAIRINxxx/MusicPlayerTransition in order to have the transition from the right instead of the bottom. This part is fine. My transition comes from the right.
My problem is that I'm embedding the presented modal view controller into a Navigation Controller. I do this so I can use the "pushViewController" function when I click on a cell of my modal view controller.
My hierarchy is as follow. I have a dashboard. From the right, I drag a TableViewController X. If I drag back in the opposite direction, I come back to my dashboard. Fine. Now, If I tap a cell, it pushes a new ViewController Y.
Now, if I am in my new ViewController Y and that I drag back, I come back directly on my dashboard instead of going back to my TableViewController X, as a natural navigation controller should behave.
I did a small project on github that does only that, so you can easily see my entire code.
https://github.com/magohamote/NavigationControllerTransition.git
I understand why it behaves like this, but I would like to know how I can override the transition set on the navigation controller in order to have the normal behaviour of my navigation controller once it is presented.
Another problem I have not been able to solve. On the project I used as a starter (the one from xxxAIRINxxx) the transition is perfectly smooth. On mine, the first time I trigger the transition, it blinks and get stuck. Once I did it once, it is smooth the next time I drag my view. But the first time is always awful. I don't know why either :(
Thank you a lot for your help!
Scenario: one UIViewController uses a custom transition to present another VC. This VC does not take up the entire screen; it's appearing as a layer on top of the first. Everything here is working great.
Now the presented VC wants to show a UIImagePickerController — to take a photo. But once that controller is dismissed, the second VC is displayed as a full-screen view: the effects of the original transition have been lost.
I've borrowed someone else's demo code for UIViewController transitions to quickly demonstrate this effect. Once you add the partial-screen second VC and bring up the camera view, dismissing it leaves you with a full-screen second view.
I've been unable to find other folks having this issue, but its repeatability suggests a framework bug.
https://github.com/aaronvegh/CustomViewControllerTransition
Found the solution: you have to set a modalPresentationStyle property on the camera VC before showing it. In my instance I set it to UIModalPresentationCustom, and that resolved the issue: when the camera is dismissed, the underlying custom transition bounds are retained.
I have a modal view controller that gets presented on iPad. Inside that modal I have a UIPopoverController that is presented to the user (triggered by a button press). What's crazy is that the popover is getting instantiated and rendered, but directly underneath the modal. I am presenting from a UIBarButtonItem, so there shouldn't be any view hierarchy issues on where it should be presented from. Doing a recursiveDescription on the window reveals that the view hierarchy is correct with the popover being on top, despite it visually being drawn underneath.
Any thoughts in what could be causing this? How do I fix it?
Update: I decided to try presenting a form sheet modal on the modal and experienced the same problem: the form sheet modal is rendered underneath the first modal. Truly puzzling...
After a night's sleep I instantly discovered the problem:
destination.view.layer.zPosition = 1000;
Because I am doing some 3D affine transforms in the animation, I needed to raise the zPosition of the destination view's layer so that it doesn't clip the source view's layer when rotating. I was forgetting to change the zPosition back to 0 when it completes.
I have an informative overlay that I want to apply above a view controller presented as a modal. I've attempted all sorts of hacks to get the overlay (a transparent UIView) to be shown above the modal view controller without any luck.
The only thing that has had some success is adding the overlay as a subview of the main UIWindow but that negates a number of helpful features that the UIWindow provides (such as a rotation-independent coordinate system).
Is there another way to accomplish this?
Thats kind of the whole point of a modal view - its on top. The only think i can think of would be to add it as a subview of the modal view. This may require you to subclass the modal view and add in extra functionality there depending on what your actually working with
One idea that pops into mind is this:
Put your transparent overlay over the main view, launch your modal popover, add the transparent overlay again to your modal popover, but offset it's origin so that just that part of it that's needed to show within the popover space will line up with the overlay that's over the main view.
You might have an issue with getting the shading correct, but seems like it would be quick to try. Only downside I can visualize is that the borders of the popover might block some of it out.