在ios中替换应用程序启动视图控制器

时间:2014-06-14 07:13:47

标签: iphone objective-c ios7 xcode5

我必须设定条件并为启动我的应用程序提出两个起点。

我想跑

if(condition1 is true)
然后display FirstloadViewController, 否则display viewcontroller

启动方法后。我试过这个:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    NSUserDefaults *fetchDefaults = [NSUserDefaults standardUserDefaults];
    NSInteger intValue = [fetchDefaults integerForKey:@"kIntegerKey"];
    NSLog(@"%i",intValue);
    if(intValue!=100)
    {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        self.firstloadViewController = [[FirstloadViewController alloc] initWithNibName:@"FirstloadViewController" bundle:nil];
        self.window.rootViewController = self.firstloadViewController;
        [self.window makeKeyAndVisible];
    }
    return YES;
}

但运行时出现此错误:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle

我该如何解决这个问题?

0 个答案:

没有答案