I have five tabs in my main window, but I haven't created it programmatically.
What should I do to create the title through code?
Hey do you want to set the title of the tab bar button or the viewcontroller that is associated with the tab?
If you are looking for the first thing then do it like:
UITabBarItem *tabItem = [[[tabBarController tabBar] items] objectAtIndex:yourIndex];
[tabItem setTitle:@"theTitle"];
otherwise mihirpmehta
is correct.
Hope this helps.
OR
[(UIViewController *)[tabBarController.viewControllers objectAtIndex:1] setTitle:@"Title1"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With