How to persist a slide-out sidebar menu through entire iOS app - ios

Is there an established solution for how to create and persist a slide out sidebar menu (like on Facebook, or Spotify) so that it appears on any view in your iOS application? I've tried using MMDrawerController, but once i segue from the initial view, I lose the sidebar. I assume this is because I'm transitioning the entire viewController, and not just changing the centerViewController.
Of note, I am using a storyboard in my project, and would like to continue if possible.

If I have a GUI element that I want to persist permanently (or appear and disappear but be shared by multiple view controllers) then I create a root view controller and add the persistent gui elements to it and add a container view as a subclass of the RVC's main view which covers the entire size of the screen.
Then what ordinarily would have been your app's rvc is embedded within this container view.
In the example I've posted there is a UILabel on top of the container which of course could be anything (including a whole hierarchy of views, or another container view with another view controller embedded with in it, whatever you want). You can make it appear or disappear as need be throughout the rest of the program either by creating/destroying it as needed, or fading the alpha to/from 0, or changing the x.y co-ordinates to animate it onto/off of the screen etc.

Related

Modal view that does not prevent access to parent

I am trying to create a two ViewController solution where a modal view controller is presented over a UICollectionView while allowing the user to interact with the CollectionView. In this case, it is like an advanced picker, allowing the user to choose items that will populate the properties in the modal view before saving a record.
I have a presentation controller setup to present the view how and where I want, allowing full visibility to the parent view. Nothing I have tried will allow the user to interact with (scroll, tap, etc) the UIController view.
In view debugging, I see a UITransitionView that has a frame equal to the full screen. (see image) I suspect that this is the culprit. Is this even possible in iOS?
The whole point of a modal view controller is that it takes over the screen and demands that the user respond to it before doing anything else. It puts your program into a "mode" that must be dismissed before the user can go on. That is the core reason for being of a modal dialog.
If you can interact with the view controller underneath the the top view controller is no longer a modal.
What you are trying to do is wrong from a human interface standpoint, and not supported by the application framework. You need to rethink your design.
Edit:
Top-level view controllers are not designed to share the screen. If you want another view controller to cover part of the screen while the user can still interact with the view controller underneath then you should use a container view as #МаксудДаудов suggests in his answer.
I would probably put a container view on top of the rest of my view controller's content, control-drag an embed segue to the child view controller I want to display, add an outlet to the container view, and then hide the container view.
When you want to display the "picker", you could then un-hide the container view, which would reveal the child view inside and let the user interact with it, while still being able to interact with the other components in your main view controller.
There is no way allowing presented full screen view controller to interact view controller under that. Instead , add your second view controller at containercontroller at some part of first, and change first VCs collection view frame accordingly, to be able see all the list. Doing this, you will have two view controllers working together

Present view controller that is already visible using iOS 7 transitions

I need to have one UIViewController's view visible on screen and part of another UIViewController's view visible above the first one. When needed, the second view should be maximised so that it covers most part of the first view.
How can I achieve this, preferably using iOS 7 interactive transitions (being able to drag the presented view), and keeping the two views managed by separate view controllers (not just stuffing both views into the same view controller)?
Here's a mockup to make things clearer:

iOS - Keep background animation across view controllers

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.

Managing a subview shown within several tabs in a tabbed app

I have a tabbed iOS 5 app where I need to keep showing a certain subview when some of the tabs are tapped and become displayed. In the following mockups I try to explain what I need: most of the tabs should keep showing a same subview that is intended to show the status of something concerning the core functionality of the app, whereas there's no need to show such status indicator subview within some of the tabs (for example, a settings tab):
Some of the tabs may also allow to navigate through a hierarchy of views, but the subview must keep visible even if user navigates. How could I manage this scenario? Should I create a separated .nib and UIViewController for the subview, and add/remove it as a subview of the root UITabBarController? Or should I load the .nib from within each tab bar view controller, and handle the subview within the tab's view controller? Or is there another and better way to handle this situation?
Thanks in advance
Separate the subview class and its data model. The subview should listen to changes in the data model and possibly modify the data model. Each tab keeps its own subview, but since all subviews share the same data model, when you update one, you update all.

Designing view on top of multiple embed views

I have the task to design a application that has a main view which is always visible (it has a button on it's bottom side, and when pressed a image displays on top of all views), and a set of TableControllerView's that should appear under it, and the user needs to be able to navigate through them.
I know that you can embed a view inside another, but you cannot refer more than one view to it. The current way I'm trying to do now load one TableViewController inside the embed view, and when the user clicks the cell I manually load the other controller and add it as a child of the main view, which is the RootViewController. The problem with this approach is that the navigation bar gets stuck using the root view controller, so I have to manipulate the main navigation items on each subview transition, and second is that the frame for the second view I load is coming as it had full size, making some cells be under the main view button. This way doesn't uses segues for transition, so it makes the storyboard kinda useless.
I was thinking into using a TabViewController with it's tab hidden, but wanted to ask here for a better solution.
As you discovered, a TableViewController likes to fill up the whole screen (except navigation bars, tab bars, status bar, etc. which are official Cocoa Touch GUIs). When you want a table view to fill only part of the screen, you are supposed to use a UITableView but not a UITableViewController. You set your custom view controller object (subclass of UIViewController, not UITableViewController) as the table view delegate and data source. You will need to duplicate part of the functionality of UITableViewController in your custom view controller, but it's not a lot more than you have to do already to supply the data.
You should probably follow the standard design pattern and have separate view controller objects for each of the "pages" the user can navigate to. You just have a main button and image on each of them. But I could imagine why that might not give you exactly the effect you want.

Resources