user6603599 user6603599 - 4 years ago 173
Swift Question

How to add a button to a Tab Bar Controller

I mean, not a UITabBarItem, an UIButton. For example, in the Deezer app, the middle button shows a view with an animation that covers the entire screen. I don't want the button to be rounded. Just to execute the action.

Answer Source

This is a very simplistic example. You'll still have to modify it to fit your needs, but if you have a UIBarButtonItem called button that you've added to your navigationBar, you should be able to do something like this, in viewDidLoad

button.action = #selector(showView)

Then you just need to create a function to be called.

func showView() {
    let myView = UIView()
    self.view.addSubview(myView)
}

Of course this has no animations, but again this is just to point you in the right direction.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download