Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift 3 - How do I create a prominent button on a tab bar (e.g. camera button) [duplicate]

I am using Swift 3, Xcode 8.2.

I want to something like this (ignore the Oscars-themed fill) where the camera button is a bit more prominent/encircled on the tab bar:

enter image description here

I assume the whole thing is an image but is that image just naturally raised off the tab bar in some way?

Any resources or if you can point me in the right direction would be great. Thank you!

EDIT

I may have found another article that explains what I want to do: How do we create a bigger center UITabBar Item

like image 762
noblerare Avatar asked Feb 27 '17 03:02

noblerare


People also ask

How do I create a custom tab bar in Swift?

Implement a view controller that can hold some other view controllers. Show one of those view controllers. Show a tab bar at the bottom of the screen over the shown view controller. Switch between the various view controllers when the user taps on a tab bar button.

How do I make a button in Swift app?

swift in your assistant editor. You can do this by holding Option on your keyboard and clicking the ViewController. swift file in your Project Navigator. Now click on the button, hold CTRL and then drag it to your Swift file.

How do I show the bottom tab bar in Swift?

Answer: Use self. tabBarController?. tabBar.


1 Answers

One way is to simply add your UIButton on top of UITabBarController with the dummy center view controller.

Here I use storyboard and subclass UITabBarController to add that button:

enter image description here

This is my storyboard, note how the center view controller is just there for space:

enter image description here

With only those code and storyboard, this is the result:

enter image description here

Project here: https://github.com/aunnnn/TestButtonOnTabBar/

like image 194
aunnnn Avatar answered Oct 09 '22 22:10

aunnnn