2014-03-05 4 views

답변

2
UIViewController *vc1 = [[UIViewController alloc] init]; 
vc1.title = @"FIRST"; 
vc1.view.backgroundColor = [UIColor blueColor]; 

UIViewController *vc2 = [[UIViewController alloc] init]; 
vc2.title = @"SECOND"; 
vc2.view.backgroundColor = [UIColor redColor]; 

UITabBarController *tabBar = [[UITabBarController alloc] init]; 
tabBar.viewControllers = @[vc1,vc2]; 
tabBar.selectedIndex = 1; 
tabBar.view.frame = CGRectMake(50, 50, 220, 320); 

[tabBar willMoveToParentViewController:self]; 
[self.view addSubview:tabBar.view]; 
[self addChildViewController:tabBar]; 
[tabBar didMoveToParentViewController:self]; 
+0

내가 내 MainViewController에 있음을 넣어해야 .xib 또는 스토리 보드없이 솔루션이 있습니까? –

+0

tabBar를 추가하려는 위치에 넣으십시오 – morroko

+0

고맙습니다.하지만 어디에서 항목을 넣을 수 있습니까? –

관련 문제