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.
Asked
Active
Viewed 3,491 times
1
-
The TabBar compatible with their own buttons not UIButton – Mannopson Feb 06 '17 at 13:20
-
So is there any workaround to make this work? – Toma Feb 06 '17 at 13:23
-
You don't need a UIButton to do what you've mentioned. It's as simple as adding a target. – Benjamin Lowry Feb 06 '17 at 13:30
-
@BenjaminLowry, can you, please, show me how? – Toma Feb 06 '17 at 13:31
-
@user6603599 Perhaps you're looking for animate the buttons transform! Right? – Mannopson Feb 06 '17 at 13:32
-
@Mannopson, I want that when the button is pressed, a view controller appears from bottom to top, and to hide it by swiping from top to bottom. – Toma Feb 06 '17 at 13:33
-
Possible duplicate of [Make custom button on Tab Bar rounded](http://stackoverflow.com/questions/36014073/make-custom-button-on-tab-bar-rounded) – ThomasCle Feb 06 '17 at 13:34
-
@ThomasClemensen, no, it isn't. My target isn't to make the button rounded – Toma Feb 06 '17 at 13:36
-
1@user6603599 https://youtu.be/G5UkS4Mrepo Hope it helps you – Mannopson Feb 06 '17 at 13:40
-
@Mannopson, yes, thank you so much! – Toma Feb 06 '17 at 13:42
1 Answers
1
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.

Benjamin Lowry
- 3,730
- 1
- 23
- 27
-
Thanks! I will write an animation. How can I make it disappear by swiping from top to bottom? – Toma Feb 06 '17 at 13:37
-
Well, I'm not 100% sure, but I think using a pan gesture recognizer might work. – Benjamin Lowry Feb 06 '17 at 13:37
-
-
1You can refer to [this answer](http://stackoverflow.com/questions/24215117/how-to-recognize-swipe-in-all-4-directions) for inspiration. Then just dismiss the VC in the selector parameter. – Benjamin Lowry Feb 06 '17 at 13:41
-
1
-
-
I noticed now that you have written "UIBarButtonItem". It's a UITabBarItem. – Toma Feb 08 '17 at 18:31