码迷,mamicode.com
首页 > 其他好文 > 详细

Xcode6 用xib文件 创建窗口

时间:2015-03-11 15:00:09      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:

Xcode6 用xib文件 创建窗口


1. 用xib 文件创建

1. 打开xcode File -- > New... --> file... -- >View技术分享技术分享

2.View和视图做个关联

(1) 打开nib文件

技术分享

(2)点击"File‘s Owner", 按command+4,设置Class为xxxViewControler

技术分享

(3) 按Control+"Files‘s Owner", 里面有个默认的IBOutlet变量view, 看一下后面有没有做关联,如果没有就拉到下面的View和视图做个关联

技术分享

4.用xib文件,创建view界面

FirstViewControllerfirstViewController =[[FirstViewControlleralloc]initWithNibName:@"firstTT"bundle:nil];



2.用storyboard  中的View Controller 创建view界面

 1.在storyboard中创建view controller 界面

  技术分享
  

 2.把storyboard 中的view controller Sotryboard ID 设置为first

技术分享   

3.添加代码 创建界面

UIStoryboard *futureStoryBoard = [UIStoryboardstoryboardWithName:@"Main"bundle:nil];

FirstViewControllerfirstViewController = [futureStoryBoard instantiateViewControllerWithIdentifier:@"first"];



为了大家写代码时能有完整参考,特传上了源码

http://download.csdn.net/detail/liuyinghui523/8491405


技术分享

技术分享

Xcode6 用xib文件 创建窗口

标签:

原文地址:http://blog.csdn.net/liuyinghui523/article/details/44196019

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!