您可以在appDelegate類中指定根視圖控制器。它應該是這個樣子:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.viewController = [[[ViewController alloc] initWithNibName:@"theNameOfMyXib" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
,你需要添加的重要的線路有:
self.viewController = [[[ViewController alloc] initWithNibName:@"theNameOfMyXib" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
而且initWithNibName下,你把你創建了界面的廈門國際銀行的名稱
。
注意:如果您的項目沒有使用ARC,請僅添加autorelease
。
這意味着你還沒有設置你的應用程序'rootViewController' ...顯示你的'didFinishLaunchingWithOptions:'方法體....它應該看起來像@NSPostWhenIdle示例 - – TheTiger
其實我看不到我的視圖控制器我的didfinishlaunchinfwithoptions:BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; //覆蓋應用程序啓動後自定義的點。 self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; 返回YES; – Andrea