init、initWithCoder、initWithFrame、initWithNib
来源:互联网 发布:国外在淘宝买东西 编辑:程序博客网 时间:2024/06/13 05:59
- TestViewController * tempVC = [[TestViewController alloc]initWithNibName:@”TestViewController” bundle:nil];
[self.view addSubview:tempVC.view];//存在XIB
调用的是 initWithNibName。
2.
TestViewController * tempVC = [[TestViewController alloc]init];
[self.view addSubview:tempVC.view];//存在XIB
调用的是 initWithNibName & init。
3.
TestViewController * tempVC = [[TestViewController alloc]initWithNibName:@”TestViewController” bundle:nil];
[self.view addSubview:tempVC.view];//不存在XIB
调用的是 崩溃。
4.
TestViewController * tempVC = [[TestViewController alloc]init];
[self.view addSubview:tempVC.view];//不存在XIB
调用的是 initWithNibName & init。
xib中拖拽其他控件,被拖拽的控件会调用 initWithCoder & awakeFromNib
代码添加其他控件
MyView * tempView = [[MyView alloc]init];
[self.view addSubview:tempView];
被拖拽的控件会调用 initWithFrame & init
0 0
- initWithNib init initWithCoder initWithFrame
- init、initWithCoder、initWithFrame、initWithNib
- 浅谈initWithNib,initWithNibName,initWithCoder,awakeFromNib ,initWithFrame
- init/initwithcoder/initwithframe
- initwithcoder initwithNib
- initwithcoder initwithframe initWithNibName awakeFromNib initWithCoder
- initWithCoder与initWithFrame
- initWithFrame: 和 initWithCoder: 区别
- initWithFrame 和 initWithCoder
- initWithFrame 和 initWithCoder 差别
- initwithcoder和 initwithframe 区别?
- initWithFrame 和 initWithCoder
- initWithFrame 和 initWithCoder
- initwithcoder和 initwithframe
- initWithFrame 和 initWithCoder
- initWithFrame 和 initWithCoder
- initWithNibName,initWithCoder,initWithFrame
- initwithcoder和 initwithframe
- python 关闭 os.popen()
- 获取当前环境下最佳的位置提供者
- 二维矩阵联通块的个数
- qyktymrfezeyyygy
- 云计算的关键技术
- init、initWithCoder、initWithFrame、initWithNib
- C++ 程序变量作用域生命周期笔记
- Sublime2编译Python3程序EOFError:EOF when reading a line解决方法
- iOS CocoaPods集成简介
- js中函数声明和函数表达式的不同
- linux下进程间通信的几种主要方式简介
- 欢迎使用CSDN-markdown编辑器
- 数据仓库(DATA Warehouse)核心概念
- 如何跟程序员谈一场没有Bug的恋爱