Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/118.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 创建没有故事板的项目_Ios_Iphone_Ios7_Storyboard_Xcode5 - Fatal编程技术网

Ios 创建没有故事板的项目

Ios 创建没有故事板的项目,ios,iphone,ios7,storyboard,xcode5,Ios,Iphone,Ios7,Storyboard,Xcode5,我正在通过BNR出版的《ios编程》一书学习ios编程 我需要创建一个没有故事板的项目来遵循这本书 我只是在下面检查这个答案,但不知怎么的,它对我不起作用。 编译器在AppDelegate.m. #import "AppDelegate.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)

我正在通过BNR出版的《ios编程》一书学习ios编程

我需要创建一个没有故事板的项目来遵循这本书

我只是在下面检查这个答案,但不知怎么的,它对我不起作用。

编译器在AppDelegate.m.

#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

从模板创建一个空应用程序。然后右键单击并添加新文件,然后在左窗格中选择并选择cocoa touch,将ViewController添加到项目中

然后选择第一个选项Objective-C类,然后为该类命名

从子类中选择UIViewController

确保选中带有选项“with XIB或用户界面”的复选框,然后单击下一步

没有故事板的项目是在XCode 5中创建的

如果你想导航控制器,它可以实现如下代码

Appdelegate.h

#import <UIKit/UIKit.h>

@class InitialViewController;


@interface SampleAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) InitialViewController *viewController;

@end

项目创建时间未选中“情节提要”选项

新建项目->单一视图->未选中的情节提要,如下图所示

内部appdelegate

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
        self.TestViewController = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];
        self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.TestViewController];
        self.window.rootViewController = self.navigationController;
    }

我在这方面很新,所以这可能是一个非常愚蠢的问题,但对于那些回答这个问题的人,请提前感谢!您似乎没有导入头文件TestViewController.h。请您添加显示此警告的代码,谢谢!当我添加头文件TestViewController.h时,一切看起来都很好!!谢谢,但如果我不仅要添加ViewController,还要添加NavigationController呢?我应该在“-(BOOL)应用程序:(UIApplication*)应用程序完成启动时使用选项:“在AppDelegate.m文件中?哇!作品谢谢:))
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
        self.TestViewController = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];
        self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.TestViewController];
        self.window.rootViewController = self.navigationController;
    }