How to add add UITabBar programmatically for iphone app. Need some suggestion and sample code.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- back button text does not change
相关文章
- 现在使用swift开发ios应用好还是swift?
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
Here the two aspects....
First Aspect (UITabBarController): Here You can add multiple classes (i.e Viewcontrollers) to the UITabBarController as show in the previous answers...
Second Aspect (UITabbar): Here You can add the Tabbar in any view controller...And for this Tabbar you can add multiple UITabBar Items..and You can get the individual Tabbar Item Action.....
See the Below Code For UITabBar
---------> Adding UITabBar
---------> Adding Items to UITabBar
---------> Getting The Item Actions in a Delegate Method
Update: (Swift 2.0)
1. First Aspect (UITabBarController):
This will allow us to configure
UIViewController
s astabbar
items inUITabBarController
.Below is the basic approach for UITabBarController:
---------> Adding UITabBarController to window in appdelegate
---------> Configuring UIViewControllers
---------> Attaching UIViewControllers to UITabBarController
---------> Receiving event in 'UITabBarControllerDelegate'
2. Second Aspect (UITabBar):
This will allow us to create
tabbar
items. We can get event for individual item in delegate methodBelow is the basic approach for UITabBar:
---------> Adding UITabBar to a view
---------> Preparing TabbarItems
---------> Adding UITabBarItems to UITabBar
---------> Receiving event in 'UITabBarDelegate'
here is what u can do
This will create a tab bar with four tabs and each tab with its own viewcontroller and navigation controller, i.e each tab maintains its own stack to push and pop the view controller. I hope that helps U.
Here is the code for making TabBarController programmatically. Hope this will help you.
You can do something like:
To add some items to it, you can write: