I found this code here that i think will do the job.
`/* suppose we have a UITabBar *myBar, and an int index idx */
NSMutableArray modifyMe = [[myBar items] mutableCopy];
[modifyMe removeObjectAtIndex:idx];
NSArray *newItems = [[NSArray alloc] initWithArray:modifyMe];
[myBar setItems:newItems animated:true];`
The question is, where should i write this code in order to work?
I tried putting it in viewDidLoad of the UITabBarController but it didn’t work.
If you’re modifying the tabbar items from the
UITabbarController, you can’t usesetItems:animated:. From the docs:Instead, swap out the
viewControllersproperty of yourUITabbarController, removing theUIViewControllerthat corresponds to the tabbar item you want removed. For example, if you want to remove the 2nd tabbar item: