iOS - Keep background animation across view controllers - ios

I'm using a basic UINavigationController design for the settings pages of an app. Each settings page is its own view controller (with xib), and each page has the same background image.
I've since built a view-based animation to replace the background image, and I'd like it to play uninterrupted while the user moves from page to page. In other words, it's as though each settings page had a transparent background, and beneath all of them was a single instance of my animating view.
How would I go about doing this?
So far, I've tried just putting the animation on each page separately, but the transitions look a bit too sloppy for me. I'd also considered somehow having a single UIView with all necessary animations underneath my navigation controller, but not sure a) if that's feasible, and b) how to go about that.
Thanks for reading.

Sounds like you want to be using "Container View Controllers"
You can read up on the Apple documentation here: https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html
The solution would be to have one master view controller which holds onto your settings view controllers. The settings view controllers background is transparent so you see the background of the master view controller.
As for the animation see Listing 14-3 Transitioning between two view controllers on the link I provided you.

Related

Change detail transition animation UISplitViewController

I have a UISplitViewController. When run in compact mode the detail views are "pushed" onto the navigation stack like pages (with the back button in the navigation bar).
I would like to simply change the page transition animation from a push from the side, to a modal style animation: i.e., have the detail view slide in up from the bottom. But only have it animate as a modal when the UISplitViewController is in compact mode (running on smaller devices - i.e., iPhones, etc).
An image for context:
As you can see, this is a normal page transition, but I would like the detail to slide up like a "page sheet" transition if possible.
I've tried modifying the segue in Main.storyboard however that changes the transition even for regular sizes (i.e., iPads, etc) which makes an additional detail view slide over the side-by-side view that's seen on regular sized devices.
Any help is appreciated!
Although it is doable, I would highly recommend against it. If you still want to go ahead with it, the simplest way would be to create two identical viewControllers with two different segues and segue types. Then you can make a check on device idiom and call the relevant segue. Again, I would not recommend such an approach

UISplitViewController should be root, so how to "push" the real starting view on top?

My app design is very simple, at least with respect to describing the intended user-facing views:
The starting view is initially empty. Pressing a "Select" button in the navigation bar transitions to a split view. On the left (master) are the photo albums on the device. On the right (detail) are the images in a given album. The user can select up to 6 images across all albums. Pressing a "Done" button in the navigation bar transitions back to the starting view, which now displays the selected images in a grid. And that's it.
In my head, this should be as simple as embedding the starting view in a navigation controller and adding a segue from the "Select" button to the split view. But of course, it doesn't work that way. According to the Apple docs:
Although it is possible to install a split view controller as a child
in some other container view controllers, doing is not recommended in
most cases. Split view controllers are normally installed at the root
of your app’s window.
If at all possible, I would like to retain my user-facing design without any shady business. I strongly suspect that there are one or more "sanctioned" ways to accomplish what I want, but I am too inexperienced with iOS development to know what they might be. Any help is appreciated!
If all you want is to pass back to the starting view controller the array of images, than why not just declare a protocol in the Split ViewController that the starting controller can adopt?

How to always show a viewcontroller even when navigating screens in iOS?

I have this music player view controller that can be minimized. Thanks to LNPopupController[https://github.com/LeoNatan/LNPopupController].
Everything is working fine, but I have no idea how to make this music player view controller stays on top even when the user navigates to the other screens (even when the main navigation controller pushes another view controller). The app doesn't use tab bar controller by the way.
So, is there a way to implement this kind of idea? Again, sticking the minimized view controller on top of every screens of the app?
Developer of the framework here.
If you present the popup bar from a navigation controller, it will appear for all pushed controllers. Likewise for a tab bar controller.
If you need to have it for all controllers, it's not easily possible. One way is the have your entire application scene appear as a child controller of a view controller, and have that controller present the popup bar. This is a difficult way to make it work, and not recommended. It has many issues.
The popup controller is not meant to appear on the screen all the time. It is meant to implement a similar functionality as Apple's.
add the minimized view controller on keyWindown which your minimized view controller always on top ,I didnot Know whether can help you,the code demo gif as is show,If anyone need Demo,give me Email:59620one463qq.com(replace one to 1) to get demo

Displaying user information on an popover alert view controller

I am working on an app for a Cafe where users can "sign in" to their seats.
Currently I am thinking of a way to present basic user information of seated people. What I am envisioning is to when the table gets tap, a square information box (pardon my primitive language) appears in the middle with the background being blurred out. I am hoping to have something flexible so that i can add tab and such to this so called box.
I have been looking at popover alert controllers and apparently there is limited information on them in regards to the iPhone. Is there a reason why popover view is not used for iPhones as compared to iPads? Moreover, is there a smarter UI to handle this or should i just segue to the next view when tapped.
Basically, popovers are iPad-only because iPhone screens are too small to make them effective. UIAlertController is a similar alternative, though it may not lend itself to what you're trying to accomplish.
Segueing to a new view for the user information is definitely a solid option, or if you want to preserve the feeling of staying on the same view you can animate a custom view over top of your current view, often from the bottom in the style of a keyboard or the settings drawer.
I think you are mixing up two different concepts: Alerts vs View Controllers being displayed modally.
Alerts – as the name suggests – are used to bring something important to the attention of the user. They usually interupt the current flow.
View Controllers presented modally are similar to what you discribe: a new View Controller moves over the current one, and the current one is blacked out to put emphasis to the new one. As you rightly pointed out though, this is hardly used on iPhone: This is because iPhones historically have rather small screens, and scaling down a view controller leaves hardly any room for content.
View Controllers presented as popovers is yet another thing: Here, you show the new view controller in a separate window that originates from a specific point in your UI.
This document might be of interest for you.
You may want to use a Modally presented View Controller. For this, you will create the view you want to pop up in a separate view controller. Then, control-drag in a segue from the parent view to the Modal of type Present Modally. You can even get your blurriness by setting your Modal's background to clear and adding a Visual Effect with Blur to its view.
Now, give the segue an identifier in the right hand pane so you can call it programatically.

Can I move from a login View to a SplitView in an iPad application?

Hope there is not an answer yet (I've checked). Can I introduce a login View in my application that enables a SplitView by using a button or something?
I've checked MGSplitViewController, but I'd like to use something more light and minimal.
If it's not possible, can I introduce a login View in my DetaiView that enables a TableView?
You can transition between arbitrary view controllers in iOS. The usual ways are using modal presentation (I like to present splash screens with a cross-dissolve animation to the root view controller of the app), or pushing/popping with navigation controllers. You can also programatically swap between multiple views in a view controller via setting the "view" property.

Resources