Reputation: 1563
I want to add multiple Controllers that are same instance to my tabBarController.but I can't.the added controllers of array treated as a one controller. How I should do ??and What is the best way??this is my code.
RootViewController *rootViewController = [[[RootViewController alloc]init]autorelease];
tabBarController = [[[UITabBarController alloc]init]autorelease];
[tabBarController setDelegate:self];
[tabBarController setViewControllers:[NSArray arrayWithObjects:rootViewController,rootViewController,rootViewController,rootViewController,rootViewController,nil] animated:NO];
Upvotes: 2
Views: 82
Reputation: 1661
You could try this :
RootViewController *rootViewController = [[[RootViewController alloc]init]autorelease];
RootViewController *rootViewController2 = [rootViewController retain];
RootViewController *rootViewController3 = [rootViewController retain];
tabBarController = [[[UITabBarController alloc]init]autorelease];
[tabBarController setDelegate:self];
[tabBarController setViewControllers:[NSArray arrayWithObjects:rootViewController, rootViewController2, rootViewController3, nil] animated:NO];
Upvotes: 1