Show modal view when select tabbar item - ios

I have a tabbar application with 3 tabbar items. Each item is a navigation controller.
However, do you guy know how to show modal view controller when tap on the tabbar item (for example, tap on the 3rd item)? The animation should be: when I tap to the tabbar, the selected view controller will move from the bottom edge to top.
In the normal tabbar, the view controller will appear as soon as we select the tabbar item
Don't have enough reputation point so please see the link

when you init barbuttons you should add selector to your buttons try this
Add a custom selector to a UIBarButtonItem

Related

Show main TabBar for an item which is not a TabBar Item, but is in Menu(Using SWRevealCotroller)

I am using SWRevealViewController for side menu.
and also I have a tabbar controller as main view in my app.
In my menu I have "MenuItem" (which presents MenuItemViewController) and the tab bar items are "TabItem1" and "TabItem2".
Here is what I need:
Show the tab bar in "MenuItemViewController".
To have back button(bar button) that goes back to the TabItem1ViewController.
I do not want to have a new item for "MenuItem" in my tabbar.
What I Have
What I Need
BTW, the top left view controller is the side menu.
I have something that i think will match your requirement, or maybe you'll get an idea from this.
What's happening here is a tab bar with any number of view is embedded inside a navigation bar. and the menu screen is the rear view of swrevealView and navigation bar is the front view. Ask if you have any doubt.

Pop view segue in Xcode

I have 2 UIViewControllers with their own navigation bars, but they're not embedded in a Navigation Controller. I want the bar button item of the first view to push the second view, and a bar button on the second view to pop the view, showing the first view underneath.
I've added a show segue from the first view to the second one in my storyboard but I can't find a pop segue when I try add a segue between the second view's bar button back to the first view. Here's what my storyboard looks like:
How would I make the back button on the second view pop itself to show the first view?

Adding buttons to navigation controllers

I am working in a swift 3 xcode 8 project, and I have an issue.
I have some view controllers.
In the first one I've inserted a navigation controller, which gives me the "back" button when I am in another view controller. So I can go on and back to the first viewcontroller.
The thing is, lets say, when I am in the third view controller I'd like to insert a button, but appearing just in this viewcontroller in the navigation controller.
I've tried adding a bar button item but it doesnt work because the navigation controller only appears, in the storyboard, in my first viewcontroller.
So how can I add buttons to the navigation controller, in another viewcontrollerS?
So how can I add buttons to the navigation controller, in another viewcontrollerS
Drag a Navigation Item into your third view controller. Now you can add bar button items to that.

SWRevealController click event does not work, while sliding background works well

Using SWRevealViewController, I made a slide view which appears from the right. It is supposed to be triggered by clicking a certain button on the navigation bar or sliding the screen right to left.
The view which appears is displayed in the center of the screenshot.
The problem is that it works only when slid to left, not the button clicked. The following is the code working with the sliding view, which is written in the UIViewController class for the view controller on the right in the screenshot.
The variable 'listBarBtn' is liked to the button with an image of three horizontal lines, a UIBarButtonItem in the right top of the same view.
listBarBtn.target = self.revealViewController()
listBarBtn.action =
#selector(SWRevealViewController.rightRevealToggle(_:))
self.revealViewController().rightViewRevealWidth = 293
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
The second line was like the following one at first; I was suggested to change it by the compiler.
listBarBtn.action = Selector("rightRevealToggle:")
And here are the identifiers of the arrows between views:
Reveal View Controller->Vc imozomo Slide: sw_right (reveal view controller set view controller)
Reveal View Controller->Vc info Navigation: sw_front (reveal view controller set view controller)
Vc imozomo Slide->the view on the right with title in korean: myPage(reveal view controller push view controller. In a test project this did not require any identifier but prompted a warning message saying I need one)
Is there any code I have missed?
listBarBtn.action = #selector(SWRevealViewController.rightRevealToggle(_:))
is fine.
does listBarBtn connect to your view controller as an IBOutlet? or
does it cover with the bell image?
did you check the UIBarButtonItem is clickable?
Did you set the segue identifier as sw_right for right reveal. sw_rear will reveal left while the sw_right will slide the right menu.

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..

Resources