用Xcode6创建xib窗口

来源:互联网 发布:三星清零软件 编辑:程序博客网 时间:2024/05/18 20:07



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"];

0 0
原创粉丝点击