技术文章分类(180)

技术随笔(11)

xcode5.01新建一个工程(用xib)

现在情况好像是xcode5.01开始新建工程默认是用storyboard,一开始无法选择xib。so,下面是我打解决办法

1,新建Single View Application,这里假设(以下参数可以随便填写,不影响操作,建议规范使用,方便项目管理):

Product Name:Study2

Organization Name :dongway

Company Identifier:com.dongway

Class Prefix :MartinLi

Divices:iPhone

 

创建完成后

2,删除Main.storyboard ,并且删除Supporting Files/Study2-Info.plist 下面打Main storyboard file base name

3,新建User Interface:Empty,并命名为MartinLiViewController.xib(这里主要是为了跟.h .m文件名统一,是个规范)

 在xib的主窗口中设置:File's Owner(在左边):Custom Class(在右边)为MartinLiViewController

 增加:view,并且关联New Referencing Outlet到 File'Owner

 

 

4,最后一步在AppDelegete.m中编写代码即可看到效果:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    MartinLiViewController *rootViewController = [[MartinLiViewController alloc] initWithNibName:@"MartinLiViewController" bundle:nil];
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.rootViewController = rootViewController;
    [self.window addSubview:rootViewController.view];
    [self.window makeKeyAndVisible];
    return YES;
}

posted @ 2014-05-27 11:20  坤哥MartinLi  阅读(232)  评论(0编辑  收藏  举报