The problem is the way you are accessing the UITabBar
.
As you said, you already have this code placed in the class that is inherited from UITabBarController
, then you should access the UITabBar
as
self.tabBar
instead of
self.tabBarController.tabBar
Try using this efficient code:
for(UITabBarItem *item in [self.tabBar items]) {
NSLog(@"Title: %@", [item title]);
}
Here is the attached sample project.Project attached