응용 프로그램 대리인에 UITabBarController
을 추가 할 필요가 없습니다. 단지 가장 일반적인 사용 방법 일뿐입니다. 초기보기에서 간단한 UIViewController
을 사용하고 단추를 누를 때 UITabBarController
(프로그래밍 방식 또는 펜촉)을로드 한 다음 표시 할 수 있습니다. 내가 다른의 UIViewController에서 오전 만약 내가 loadTabBarController 전화를 어떻게
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// viewController is a UIViewController loaded from MainWindow.xib with a button that calls loadTabBarController
[window addSubview:viewController.view];
[window makeKeyAndVisible];
return YES;
}
- (IBAction) loadTabBarController {
self.tabBarController = [[[UITabBarController alloc] initWithNibName:@"MyTabBarController" bundle:nil] autorelease];
[viewController.view removeFromSuperview];
[window addSubview:tabBarController.view];
}
다음
는앱 위임에있을 수 있습니다 무엇의 예입니다? –
필자의 예에서는 Interface Builder에서 유선화되어 있습니다. MainWindow.xib는 viewController를로드합니다. 프로그래밍 방식으로 수행하려는 경우 단추의 대상을 응용 프로그램 대리인으로 설정하고 정상적인 동작을 설정할 수 있습니다. –
viewController에 인터페이스 빌더의 IBAction에 연결된 버튼이 있다고 해봅시다. viewController가 appDelegate에 있으면 window에 대한 참조를 얻는 방법은 무엇입니까? –