建立UINavigationController

設置UIWindow的根視圖爲導航控制器  app


#import "CYYAppDelegate.h"
#import
"CYYViewController.h"

@implementation CYYAppDelegatespa


- (
BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
   
self.window.backgroundColor = [UIColor whiteColor];
   
   
// 1. 實例化導航控制器
   
 CYYViewController *one = [[CYYViewController alloc] init];
   
   
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:one];
    nav.
view.backgroundColor = [UIColor redColor];it

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

相關文章
相關標籤/搜索