Bilal Mughal
Bilal Mughal

Reputation: 5

UITabbar also change the tab with extra UIButton [hell] swift 4

New to swift 4 programming need help in UIButton.

There are two buttons for appointments, one on tabbar and other is UIButton. How can i program that UIButton to navigate to “Appointments UIView on UITabbar” without disappearing the tabbar when navigating?

Upvotes: 0

Views: 35

Answers (1)

mcgtrt
mcgtrt

Reputation: 787

I don't know if I understand you well, but if I'm right you want to access a specific tab by touching a UIButton, not the UITabBarController.

Solution for this is adding an action to your button like below:

@IBAction func goToAppointments(sender: AnyObject) {
    tabBarController?.selectedIndex = x
}

Where x is an integer with the position of "Appointments Tab" in tab bar.

Upvotes: 1

Related Questions