2011-09-22 6 views

답변

1

didFinishLaunchingWithOptions라고하는 AppDelegate.m 파일의 메서드 (또는 응용 프로그램 대리자 파일의 제목)가 제어됩니다. 예를 들어, 탭 표시 줄 응용 프로그램에서 나는 다음과 같습니다 만들었습니다

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    // Override point for customization after application launch. 
    // Add the tab bar controller's current view as a subview of the window 

    self.window.rootViewController = self.tabBarController; 
    [self.window makeKeyAndVisible]; 
    return YES; 
} 

당신이해야 할 self.window.rootViewController의 값을 변경합니다. 예를 들어, MapViewController가 첫 번째 페이지로 열리길 원한다고 가정 해 봅시다. 다음과 같이 할 수 있습니다.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    // Override point for customization after application launch. 
    // Add the tab bar controller's current view as a subview of the window 
    MapViewController *mvc = [[MapViewController alloc]initWithNibName:@"MapViewController" bundle:nil]; //Allocate the View Controller 

    self.window.rootViewController = mvc; //Set the view controller 
    [self.window makeKeyAndVisible]; 
    [mvc release]; //Release the memory 
    return YES; 
}