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.
Related
I'm programmatically presenting a view ontop of my main view controller's view. On the view I'm programmatically presenting there are buttons. The problem comes when I tap on one of these buttons, I'm interacting with the view I've presented my view overtop of. For example, I've got some buttons behind the view I'm presenting, and if I tap in the view where the covered up buttons are, the code still is getting run for the buttons behind the view even though they're hidden behind.
The only way I can think to stop this is to add tags to each of the views within my presented view and then do some logic like "while I'm presenting this view, go through all of the subviews on the main VC, and if those tags don't equal any of the tags in the presented view, turn off user interaction"
It seems super common to present a view overtop of other buttons/views. Is there a better way to accomplish this?
Turn on User Interaction Enabled for the covering view. Now touches cannot fall through to the covered buttons behind it.
I want to modely present a view controller, and during the animation I want to shrink the presenting view controller. I saw a lot of apps doing this effect, its seams that the entire view controller including the navigation bar is shrieked.
I'm not sure how to approach this, and I will really appreciate any help about how to make this kind of effect.
here is an example from the mail app, you can see that when the compose view controller is presented, the other view controller is shrieked behind him:
If this was for iPad I would tell you to simply use an embed segue, or resize your modal container's superview, but since it is for iPhone that makes things trickier. Apple has said that modal presentation for iPhones is always supposed to be the whole screen, so I doubt they did theirs modally. They either made a custom segue type (I'm not sure how to go about doing that), or they simply are using a view and presenting that on the bottom portion of the screen, with a view inside of it to represent the navigation controller.
You can add a different viewController's view to the current view controller then call parentVC addChildViewController: and use it like that. Just use a toolbar instead of a nav bar and it should work fine.
I was looking to do the same and I found this answer by Brian Sachetta that explains how to accomplish it. The link posted in the answer didn't work for me but I found the sample he is talking about here
Have you used Tinder app?
That app is full of nice effects that makes a great UX experience in my opinion.
Try to open it and you see the launch image with a red flame at the center of the screen.
Seconds after the flame moves itself to the navigation bar to make the app logo.
The animation I am trying to create it exactly that and I can't figured out how to (1) let the navigation bar appear in that way and (2) to transition a custom UIView inside another view.
If I'd find an app to record the screen of my iPhone I will post a video explaining the animation I'm referring to.
In the meanwhile, do you have any ideas?
The animation I am trying to create it exactly that and I can't
figured out how to (1) let the navigation bar appear in that way and
(2) to transition a custom UIView inside another view.
Animation's are often not exactly what they seem to be. For example, when you segue from one view controller to another the animation you see often uses images instead of transforming the actual views.
You can do the same kind of thing for the animation you want. You don't have to actually move a view from one view controller to another -- just create the appearance that you did:
Create an animation that moves the image in question (like the flame) into position on top of the navigation bar.
Set the titleView of the destination view controller's navigation item to include the same image in the same location.
Remove the animated image. The user won't notice a change because the same image is already present at that location.
I am developping a Master-Detail based iApp and I would like a specific button in the Master pane to trigger the apparition of a "settings" Form Window.
I then set my segue as "modal" and I get a form view covering the whole screen. This form comes from the bottom of the screen.
How do I get my view to appear from a slot at the top of the window and to cover, say, 2-thirds of the screen width and 3-quarters of its height?
Thanks!
You can't readily do it using the modal presentation styles, as they are fixed sizes. It is possible to work around but you need to mess around with resizing private views and it quickly starts to feel a bit fragile and messy.
It's simpler to create your own view controller at whatever size you like, add it as a child view controller and animate it into position yourself. You can even add your own background dimming view.
You lose the convenience of segues and the dismissal code, as you're no longer "presenting" the new VC, but that's not hard to recreate.
I am trying to replicate the iPad passcode view. Which basically is a popover with no arrow direction, that locks the background view kinda like a modal view controller.
My question: Is there a way to lock the underlying background view when presenting a popover.
My idea: The only real solution that i could come up with is placing that popover inside a modal view controller. and presenting it that way.
Thoughts?
Use the modalInPopover property of your view controller: http://developer.apple.com/iphone/library/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006926-CH3-SW72
This question provides some information on making a popover with no arrows, though it's not clear whether it's correct or not: UIPopover without any arrows