简体   繁体   中英

Add a button to tab bar controller scene in storyboard

I am trying to design a application that has a tab bar on the bottom and two buttons on the top of the screen.

在此处输入图片说明

However, I'm not able to drag a UI Button onto the Tab Bar Controller Scene in storyboard on Xcode. I'm able to add buttons, search bars, etc to the view controller of each tab bar item, but not the original home screen. Why is that?

The UITabBarController is a view controller, but it's really just a container for other view controllers, one per tab. If you want things to appear on all of your tabs (like the two buttons you show at the top), you have to add them to each of your sub-view controllers. (Ideally, you'd do this once in a superclass, which each of your tabs' view controllers will implement, but that may not fit your needs.)

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