2012-02-29 77 views

回答

-3

的UINavigationController pushViewController:動畫:

8

你能做到這一點,如下所示:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    // ... 
    UIViewController *myViewController = [[UIViewController alloc] init]; 
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:myViewController]; 
    self.window.rootViewController = navigationController; 
    // ... 
} 

可以更換類的myViewController和/或使用筆尖如果你想進行初始化。

1
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 


    UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:[[OptionViewController alloc]initWithNibName:@"OptionViewController" bundle:nil]]; 
    self.window.rootViewController=nav; 

    self.window.backgroundColor = [UIColor grayColor]; 
    [self.window makeKeyAndVisible]; 
    return YES; 
} 
0

它的工作對我來說:

設置你的窗口tabviewcontroller,那麼它會正常工作。

UIWindow *window = [UIApplication sharedApplication].keyWindow; 
     UITabBarController *tabVC = [self.storyboard instantiateViewControllerWithIdentifier:@"MyMainView"]; 

     [window setRootViewController:tabVC]; 
相關問題