我正在通過BNR名爲「IOS編程」的書學習ios編程。創建沒有故事板的項目
我需要創建一個沒有故事板的項目來跟隨這本書。
我只是檢查下面的這個答案,但它不適用於我。 Xcode 5 without Storyboard and ARC
編譯器說,在AppDelegate.m 「替換UIViewController中的TestViewController」。
#import "AppDelegate.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ;
// Override point for customization after application launch.
TestViewController *test = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:test];
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
選中故事板,我在這所以很新的這可能是一個非常愚蠢的問題,但對於那些回答這個問題的人,請提前致謝! – Tosh
看起來你想導入頭文件TestViewController.h。您可以添加顯示此警告的代碼 –
謝謝Anil!當我添加頭文件TestViewController.h時,一切看起來都很好! – Tosh