1、Interface Builder可视化编程编程
一、Interface Builder简介:框架
二、iOS可视化编程ide
2、xib简单实用布局
一、.xib建立测试
// 建立视图控制器,给window指定根控制器 // 程序编译时会将xib文件编译成nib的二进制文件,运行时加载nib文件 // nibName:当前控制器相关联的nib文件,若是写为nil,默认查找和控制器名相同的文件名,可是若是xib文件与控制器名不相同,则查找不到。 // bundle:获取程序的资源路径,若是写为nil,默认是主路径,由于iOS只有一个主路径,在mac端开发时必须写。 self.window.rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]];
二、控件关联ui
三、事件关联spa
四、代理设置操作系统
3、xib绘制单元格设计
一、自定义单元格代理
// 注册cell [self.tableView registerNib:[UINib nibWithNibName:@"CustomCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:identifier_cell];
// 返回cell - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier_cell forIndexPath:indexPath]; return cell; }
4、自动布局
一、自动布局
二、Stack
三、Align
四、Pin
五、Resolve Auto Layout Issues