How to add a UITabBarController to window
Hi GUys I have a window开发者_JS百科 and a tabbar. How do I add all the view controllers to the tabbar and to the window. My Code is here
UITabBarController *tab = [[UITabBarController alloc] init];
UIViewController *first = [[UIViewController alloc] init];
UIViewController *second = [[UIViewController alloc] init];
UIViewController *third = [[UIViewController alloc] init];
//HOW can i add these view controllers to tabbar and hwo to add tabbar to window...
[self.window makeKeyandVisible];
Please help.. Thanks
I'm new here but I think this will work. There are plenty of tuts out there too so you might wanna check them out. I'll try to find one for you if I can but I think this will suffice.
UITabBarController *tab = [[UITabBarController alloc] init];
UIViewController *first = [[UIViewController alloc] init];
UIViewController *second = [[UIViewController alloc] init];
UIViewController *third = [[UIViewController alloc] init];
NSArray *tt = [[NSArray alloc] initWithObjects:first, second, third, nil];
tab.viewControllers = [[NSArray alloc] initWithArray:tt];
[self.window addSubview:[tab view]];
[self.window makeKeyAndVisible];
精彩评论