How to put UIView in UITabBarController (Like Apple Music App) - ios

I'm trying to replicate the mini player on the Apple Music app. It looks like this:
Right now I have a UITabBarController plus two UIViewControllers. Now I wanted to put a UIView in the TabBarController (for the mini player) so its always on top of the content of the ViewControllers that are loaded in the tabs. But it seems to be impossible to add any UI elements into a tabBarController.
So my question is, what am I doing wrong and how can I create a View that is right above the tabbar and is above all other views in the tabs?
EDIT: the suggested duplicate doesn't answer my question. Is it not possible to add Views to the TabBarController via Storyboards?

To answer your question: No, you cannot add a view to the UITabBarController via storyboard.
Though you can have a look at LNPopupController. https://github.com/LeoNatan/LNPopupController
It's a wonderful library which will enable you to do what you want to accomplish.

To answer your EDITed question: No, it is not possible to add Views to the TabBarController via Storyboards. That's not how TabBarControllers work.
Options:
Follow the direction in the 'possible duplicate' link posted and add
subviews via code, or
Subclass UITabBarController and add subviews via
code, or
Write your own "tab bar controller" and, using IBDesignable and
IBInspectable, provide for adding subviews in Interface Builder
You could probably find inspiration / ideas by searching the web for "custom UITabBarController"

Related

Is it possible to have 2 view controllers from 2 different storyboards to be active on the screen simultaneously?

I am trying to develop something on the lines of the Uber app. I have to keep the 2 view controllers in separate storyboards. I need to pull up a drawer like in Uber over a View controller which has a scnview. In simpler term and taking Uber as an example, I need a way to accomplish the same interaction where the mapViewController is in one storyboard and the drawer having the driver details to be in another storyboard.
You can implement this feature in many other ways as well,
But answer to your question is - Yes you can display more than one controller at the same time on screen.
You can use ContainerView like this :
And using Storyboard reference, you can contain UIViewController of another storyboard's controller.
Yes you using containerView you can do this.
Step 1: Set up a Reference of storyboard
Step 2: Select Embed at above Picture
Step 3: this is your second storyboard with entry point
Step 4: This is your output

Set up UITabBarController with three other view controllers

I have a UITabBarController inside of a TabBarViewController. I want to use this to connect my three other view controllers to a tab bar.
What I have so far: I have my three view controller, each with one UIView inside of them, ready to be paired with the tab bar to give easy navigation between them. I have also made a new Objective-C class of type UITabBarController. Inside the .xib of that I deleted the UIView and replaced it with a UITabBarController (not sure if this is right).
I'm new to Objective-C and Xcode so I don't know a whole deal about it all, so I may be doing this all wrong. Please correct me and try not to be too vague, thank you!
There's a tutorial here with two tabs:
http://www.youtube.com/watch?v=NfEK9JsCyXM
You can watch it and work with it to make it do 3 tabs.

IOS slide menu like facebook and path 2.0 that works with storyboard

I try looking everywhere for opensource but couldn't find a cocoa control that has the following combination.
Slide Menu
Story Board.
Navigation controller.
TabBar controller.
I found one open source control that works with 1,2,3 but doesn't work with uitabbarcontroller.
http://www.cocoacontrols.com/platforms/ios/controls/saslidemenu
I used IIViewDeckController in a project that involved all of the things that you list.
I made a video (3 parts) on youtube on how to make a sliding menu like the on you are looking for. I show you how to set up the project and get everything linked up.
http://www.youtube.com/watch?v=tJJMyzdB9uI
The way this is set up, you should be able to just select UINavigationController instead of UIViewController when creating your files from the first video.
I use ECSlidingViewController because its the easiest to customize.
Hope this helps!
Here is a simple one I wrote. It's built on top of UINavigationController so you can use all UINavigationcontroller functions as well as slide function. No need to inherit any base class for your ViewControllers like other libraries require. Works both on Storyboard and in code.
I haven't tried, but I'm pretty sure if you set a tab-bar-controller as the root view controller of this custom navigation controller it should work as expected.
https://github.com/aryaxt/iOS-Slide-Menu
https://github.com/arturdev/AMSlideMenu
You can use this simple library.
Just connect your menu (tableViewController) to your tabBarController with a custom segue of type AMSlideMenuContentSegue.

How to add custom TabBarItem to Tab Bar Controller

I am using the Storyboard in XCode to design my Views. Also im using the Tab Bar Controller in the editor, but i cannot seem to figure out how i can add a custom item which i can use for UIPopoverController.
Is it possible or do i have to create this controller programmatically and add it?
The apple documentation states that you shouldn't subclass UITabBarController, however, you could use a custom implementation like one of the ones found here:
http://cocoacontrols.com/platforms/ios/controls/altabbarcontroller
http://cocoacontrols.com/platforms/ios/controls/center-button-in-tab-bar
EDIT: This website appear to have exactly what you want - http://idevrecipes.com/2010/12/16/raised-center-tab-bar-button/

Segues from a subView

Just trying to teach myself storyboarding and have run into a question I was hoping people may have an answer to.
I wanted to create a reusable upper toolbar so that in case I ever had to change it, it would update all of my scenes. I created a sized ViewController in my storyboard. I then load it into a subview of each of my scenes using the menu's identifier. THat seems to work pretty well (although, feel free to tell me that's the wrong way to do it).
Here's where the problem starts. On that top toolbar, I have a UIButton which I connect to another sized ViewController in my storyboard as a popover. Basically, a drop down menu. If I just load up the top toolbar, works fine. If I connect just a regular button to that popover scene using a segue, that works too. If, however, I try to click the button and follow the segue while the toolbar is within a subView I crash with EXC_BAD_ACCESS. I presume I'm not allowed to spawn a popOver from a subView or follow a segue within a subview? The latter seems wrong since you effectively do that with any UI object.
How else should I handle this?
Thanks!
I'd recommend using a UINavigationController and setting the toolbar to include your UIButton (as a UIBarButtonItem). If you have any trouble "keeping track" of the toolbar or button you can subclass UINavigationController, add the UIButton (or entire toolbar) as a property of the subclass, and access it from any subsequent view through the self.navigationController property (might violate strict OO, but you could use a protocol).
As for the popover, I think you're OK on iPad but not on iPhone. There are custom projects on github to implement UIPopoverController, and indeed the Facebook app makes use of a custom popover for notifications in their app. iPhone raises an exception if you try to show a UIPopoverController.

Resources