Is there a way to create an Instagram style camera transition, where the current ViewController slides down to reveal the camera ViewController behind it? If so, how can I implement it, and make it work with the UINavigationController nav stack?
Take a screenshot of your current view controller and present another view controller modally with that screenshot, create a UIImageView in the new view controller you presented, then dismiss the screenshot down revealing the contents of that view controller underneath
Related
I have a question about iOS push navigation controllers. I want to push view controller on slide gesture. Just like as in Snapchat application: main view captures images. If you slide from left to right, snapchat messages view smoothly slides (pushes) to main window. If you slide from right to left > contacts view. How to create this kind of navigation? Thanks a lot!
I believe the way that Snapchat does it is through UIViewController containment. Essentially, the main view controller contains a scroll view (paging enabled) with 3 child view controllers (snaps, camera, and contacts). They don't use a navigation controller to present and pop view controllers as you swipe.
See the documentation on view controller containment: https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/ImplementingaContainerViewController.html
Looking through the snapchat application you probably don't want to do this all in one UINavigationController.
Here is what you need.
UIViewController - This will be your main view. In terms of the snapchat application this is where you would take picutre.
UINavigationController - For the friends list
UINavigationController - For the snapchat (the green window)
You need to setup two segues, both leading from your main controller. Once you have your segues setup I would suggest writing your own transition. Have a look at UIViewControllerContextTransitioning, UIViewControllerTransitioningDelegate, UIviewControllerAnimatedTransitioning.
I am at work, but when I get home I'll throw an example together. However, the above should get you pointed in the right direction.
When a user taps on a UITabBar item, I would like to present a view controller modally, but I would also like the UITabBar to remain visible. When the user is finished with the modal view controller I want to dismiss it modally. Basically, I want to show one view controller on top of another and dismiss the top view controller with a modal animation, while keeping the UITabBar visible. I am thinking I have to do some sort of custom animation, but I cannot figure out how to make that work.
Anyone know how to do this for iOS 6 and iOS 7?
Modal segues coverup the previous navigation controller stack, so any existing tab, navigation, and tool bar controllers will no longer accessible. You'll either need to use a push segue to retain the existing tab bar, or add a new tab bar controller to the modal view.
I know it's possible to set a background image for the UINavigationBar, but I would like to know if there is a way to share a common background view for all controllers in a UINavigationController. The idea is to have a UIImageView as the background that stays in place rather than "sliding" over itself when navigating to a new controller.
A navigation controller is a kind of view controller and it hosts the currently visible view controller by adding the VC view to its view. You can add things to that view too. Create your image view and add it as a subview of the nav controller view, then send it to the back (or insert at index 0).
I am presenting a temporary view on top of my view controller when a user does some action.
I want it to fade the screen - including the navigation bar, like UIActionSheet does.
I am presenting the view via the root view controller of the navigation controller, so my only problem is to fade also the navigation bar and not allow touches on it.
How can I do that?
You can add a semi-transparent view on the whole UIWindow and it'll look just as you described it. You'd probably want to add your temporary view there, too, because all actions will be blocked by the semi-transparent view.
I'm writing an app that uses UIImagePickerController to let the user choose images from their library. On the iPad, it shows it in a popover (because you must) but the controller which is showing it is already in a popover, and you're not allowed to show a popover from another popover. I can't rework the whole app to avoid the files controller being in a popover, so what I'd like to do is to push the image picker onto the files controller's navigation stack.
Obviously this isn't going to work with the stock image picker, but there are a lot of alternatives. Has anyone used any of them that would let me push them onto the navigation stack, or do I need to write my own?
The proper solution is to present the image picker as a modal view controller to your existing view controller. Set the image picker's modalPresentationStyle to UIModalPresentationCurrentContext.
This will show the image picker in the same popover but as a modal view controller over the calling view controller.