I am trying to add UITabBarItems
to a UITabBar
not to a tabbar controller. Here is what I tried to do. It is always crashing when I am calling setItems. Can any please point out whats wrong.
My_Accounts *my_AccountsVC = [[My_Accounts alloc] init];
Payments *paymentsVC = [[Payments alloc] init];
Transfer *transferVC = [[Transfer alloc] init];
NSArray *VCArray = [[NSArray alloc] initWithObjects:my_AccountsVC,paymentsVC,transferVC, nil];
[self.tabbar setItems:VCArray];
Thanks
If you look at items
, it takes an array of UITabBarItem
s and not UIViewController
subclasses which you seem to be passing.
You will have to keep track of the view controllers elsewhere and pass an array of UITabBarItem
s and handle the view controllers in the UITabBar
's delegate.
Or much better, use UITabBarController
.