How to present uiview from tabbar - ios

I am working on a TabBarController base application and my TabBarController has 5 tabs.
When a user clicks on the third tab I want to present a UIView with dimensions of 280*100 and the background shows the selected ViewController.

Just have the 3rd tab reference a 3rd UIViewController that has a UIView with the dimensions you specified. If you are concerned about the nav info, etc. showing in the UIViewContoller, then you can suppress all of that.
If you want to use the tab bar to change the UI appearance of the same UIViewController (e.g. tab1 shows a UIView, tab2 shows a button, etc. all within the same VC) then you are using the wrong control.
See this UITabBarController Class Reference for the role of UITabBarController

Related

UITabBarController add viewcontroller without tab bar item

I am creating an iOS application where I need to add a SideMenu and a UITabBarController, SideMenu and UITabBarController there purpose is to let the users navigates between different ViewControllers, I have 3 tab bar items in UITabBarController and in the SideMenu I have 5 items, when the user click on an item in the side menu I have to show the corresponding view controller
Question:
It's possible to add a ViewController without a TabBarItem to the UITabBarController, when the user click on the side menu item, I trigger the UITabBarController to select the corresponding view controller, or its not possible in UITabBarController I need to find another solution, if so please advice which solution is better.
In the picture above, These are my viewcontrollers but I need to hide the tab bar item for the last view controller and keep the UITabBarViewController behave normally when I programmatically select the last view controller from the side menu
If the ViewController of the side menu is different than the TabBar. You can PUSH the view directly in the controller that is selected in the tabbar in that moment.

Tab bar/tab item disappears on two of tabs in my app

In my storyboard app, I have a UITabController, which leads to a number of UIViewController.
Two of these primary UIViewController have a series of buttons which lead to secondary UIViewController.
Each of those secondary UIViewController displays html content, and they each have a button to go back to the primary UIViewController and a button to go back to the UITabController.
On the primary UIViewController, the tab bar displays fine with the various items. If I click a button to go to a secondary UIViewController, and then click the button to take me back to the primary UIViewController, I noticed that the UITabBar and items are not appearing.
Is there a setting that I need to change with regards to the tab bar to force it to display on the primary view when returning from the secondary view?
(PS ignore the website that shows in the screenshot of the secondary view, for some reason in the simulator it shows the website, but when I compile and run on an actual device it displays the correct html file that is hosted on the same site).
When you are using modal segue then it is meaning present UIViewController.
Unlike push(show) navigation, present UIViewController can be said overlay it's UIViewController on top of it.
Let's say viewController1 is one of tabViewController item and you are going to present viewcontroller2.
Then you are present viewcontroller1 again on top of viewController2.
This is meaning at the bottom there's viewController1 nested in UITabController and viewController2 on top of it and another viewController1 on top of it again.
That's UIViewController doesn't have tab items and tab bar.
So to go back, you'd rather to use dismiss UIViewController instead of present it again.

Implement a bar over ViewController that does not animate (like tab bar)

I have two main ViewControllers in my project. I would like to add in both ViewControllers a bottom bar that has buttons (different for each ViewController) that take user to a respective subViewController, just like a Tab Bar. But the first ViewController must have a button inside its View that takes the user to the other main ViewController without animate the bar during the transition among ViewControllers. How can I do this?
I suppose you could add the view as a subview of UIWindow, and not your respective view controller. Alternatively, why not subclass UITabBar?

How to create a UIView with NavigationBar and TabBar

I would like to introduce in my app a View that will contains both navigation bar and a tab bar at the bottom. View contains a Table View with multiple entries and once user tap on a cell a push segue takes him to another view with details regarding the cell he has previously tapped. If he decides, user can go back to parent view by tapping on 'Back' button of the navigation bar on top. In addition to this, I would like my view to have a tab bar at the bottom with extra tools for the user. So, if he decides to check the 'Creator' of the app, he can by simply tap on 'Creator' TabBarItem at the bottom.
I would like to ask you what is the best way to achieve the above. I have already tried to use UITabBarController combined with UINavigationController. Didn't achieve what I was looking for because I would like the view with the table on it to be independent from the TabBarController and NOT a part of it (by part I mean by accessible through tabs).
Do you believe a UINavigationController view with UITabBarView would be a better choice?
UPDATE
What I mean by, "independent from the TabBarController and NOT a part of it":
Once the app loaded, I would like to see my main view (with table) contains Navigation Bar on top and Tab Bar at the bottom. However, I don't want to see the first tab of the Tab Bar selected because my main view will not be accessible through tabs of the Tab Bar but through Navigation Bar. If, for example, I am in Main view and tap on 1st tap, I would like to move to another view that will contains some other info.
Option 1:-
Create a tab bar Controller and on that TabbarController assign your navigation Views.
say nav1 with tab1 , nav2 with tab2...
Option 2:-
Create a Navigation View Controller and than add the tabbarcontroller on that navigationView Controller by using addSubView.
So when the user clicks on a row in a table u will go to a different View which doesn't have the TabbarController and when the user comes back he will again see the TabbarController.
This is what I will do:
First I will subclass UITabbarController and create for example ParentTabBarController. This controller will contain all the tabs necessary and what they will do if they are clicked so on.
Next for each viewcontroller I create, I will subclass from this ParentTabBarController so that the tabs are already in. You can add additional functionality or override it depending on your situation.
In your appdelegate pass in a navigation controller and every time push and dismiss the viewcontrollers you created in second step.
Hope this helps..

Right navigation item disappear when pushes JASidePanels

I am using the JASidePanels as submodule and I wanted to know if there is a way to keep the right icon on the navigation bar always visible and working.
For now I have my center panel which is a table view, and both left and right panels works.
But when I click a table view cell, it pushes a viewcontroller on it but the JASidePanel controls are lost... I cant slide it to the left to see my right panel.
Yes, I know that the left button will be replaced with the back button. This one is fine for me, I just care about the one on the right.
UINavigationController presents UIViewController (and subclasses). Each UIViewController is associated with an UINavigationItem that contains the information about the tool bar items and navigation bar items. This information is only used when that particular view controller is presented in a UINavigationController. If you want to put a button from viewController 1 in viewController 2, you need to assign the button to the UINavigationItem instance of viewController 2. Note that, if the action:target receiver for the button action is not viewController 1, you can easily create the UIBarButtonItem instance with the same characteristics in viewController1 for viewController2's UINavigationItem instance in viewController2's viewDidLoad method.

Resources