I want to set title to tab item programatically, but it not works. My code is below:
- (IBAction)tab1Click:(id)sender {
myTabBarController = [[UITabBarContro
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UITabBarController *tb=[[UITabBarController alloc]init];
UIStoryboard *sb=[UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc1=[sb instantiateViewControllerWithIdentifier:@"View1"];
UIViewController *vc2=[sb instantiateViewControllerWithIdentifier:@"View2"];
//To Set Title for UIViewController
[vc1 setTitle:@"View1"];
[vc2 setTitle:@"View2"];
NSArray *vController=[[NSArray alloc]initWithObjects:vc1,vc2,nil];
tb.viewControllers=vController;
self.window.rootViewController=tb;
[self.window makeKeyAndVisible];
return YES;
}