简体   繁体   中英

ViewController in ios 5

I have a problem in ViewController. And I'm using xcode 4.3.3, trying to implement iPhone 5.1 apps. Every time I write some code about ViewController, it reports the same error: use of undeclared identifier "viewController". And if I declare it with type of UIViewController , it has runtime error.

Some codes are like this:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{   
    self.window.rootViewController = [[UINavigationController alloc]initWithRootViewController:viewController];
    // Override point for customization after application launch.
    return YES;
}

It is in AppDelegate .m file.

Is there any difference in using viewController in ios 4 and 5?

You actually don't need to need to modify the AppDelegate for this.

Leave it blank:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    return YES;
}

And then in your storyboard file select the View Controller you want to be the first and make sure "Is Initial View Controller" is selected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM