不用storyboard,用xib开发

1. 新建一个Single View Application项目, 删除自动生成的.storyboard文件和ViewController文件

2. 新建一个UIViewController的子类,命名为ViewController,生成的对应文件为ViewController.h, ViewController.m及ViewController.xib

3. 确认工程TAGETS中的Main interface为空

4. 打开AppDelegate.m文件,添加头文件#import "ViewController.h",在application:didFinishingLaunchingWithOptions:函数添加如下代码:

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
ViewController *myViewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = myViewController;
[self.window makeKeyAndVisible];
上一篇:安装文件报错error while loading shared libraries: libssl.so.6


下一篇:python之smtplib模块 发送邮件