当我在xcode 5中创建一个新项目选择选项(单视图应用程序)时,它会自动添加Main.storyboard,因为我们在之前版本的xcode中选择了没有选择.Xib文件的选项.请有人解释一下
Mat*_*tti 20
我的建议是:
File/New/File,选择Objective-C Class命名您的类ViewController(或任何您喜欢的类),使其成为子类 UIViewController
确保您已选中"with xib for user interface"框.
打开appDelegate.h,放
@class ViewController;
之间@interface and #import,和以下这个属性:
@property (strong, nonatomic) UIViewController *viewController;
Run Code Online (Sandbox Code Playgroud)
appDelegate.m:导入ViewController#import"ViewController.h"
之前
[self.window makeKeyAndVisible];
Run Code Online (Sandbox Code Playgroud)
放
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12989 次 |
| 最近记录: |