2012-06-22 29 views

回答

1

您不能,因爲info.plist是隻讀應用程序包。你將不得不通過代碼來完成。

取下的info.plist所有mainwindows這裏有一個例子:

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

    UIViewController *rootViewController = nil; 
    // Override point for customization after application launch. 
    if (YES) { //You check here 
     rootViewController = [[SomeViewController alloc] initWithNibName:@"SomeViewController" bundle:nil]; 
    } else { 
     rootViewController = [[OtherViewContoller alloc] initWithNibName:@"OtherViewContoller" bundle:nil]; 
    } 
    self.window.rootViewController = rootViewController;   
    [self.window makeKeyAndVisible]; 

    return YES; 
} 

main.m

#import <UIKit/UIKit.h> 

#import "AppDelegate.h" 

int main(int argc, char *argv[]) 
{ 
    @autoreleasepool { 
     return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 
    } 
} 
+0

我們如何通過代碼改變呢? – Pallavi

+0

我有兩個TabBarControllers的xib文件,我認爲沒有在plist文件中添加它的名字,它不會工作。所以我想通過編碼在運行時更改它。我只有兩個具有FilesOwner作爲UIApplication類的xib文件。當應用程序啓動時,我想根據標誌更改來更改它。我們能做到嗎? – Pallavi