简体   繁体   中英

How to bring UIButton to front on TabBar?

I have a TabBar and I want to add UIButton on it, but it stays behind of tabBar:

Image( http://i.stack.imgur.com/RxGXb.png )

How can I bring it to front and make over the TabBar?

I've tried this one:

override func viewDidLayoutSubviews() {
    tabBarController?.tabBar.bringSubviewToFront(addButton)
}

but it doesn't help me

You can't easily. You could subclass the UITabBar class, but that would make you handle it yourself (without a UITabBarController):

Do not modify a tab bar that is managed by a tab bar controller (an instance of the UITabBarController class). If you do so, the system raises an exception. Modify a managed tab bar, or its items, only through the tab bar controller API.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM