xib和Storyboard 创建Cell的方式
2015-04-02 09:27
197 查看
xib 方式 1.在Cell.h文件中加一个宏 #define cellIdentifier @"customCell" 2. ViewController中: - (void)viewDidLoad { [super viewDidLoad]; [_tableView registerNib:[UINib nibWithNibName:cellIdentifierbundle:nil] forCellReuseIdentifier:cellIdentifier]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; return:cell } StoryBoard方式 1.在Cell.h文件中加一个宏 #define cellIdentifier @"customCell" 备注:IB中Identifier 也要填 customCell 2.ViewController - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { CustomCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier forIndexPath:indexPath]; return cell; }
相关文章推荐
- iOS 关于使用xib创建cell的两种初始化方式
- 大钟的ios开发之旅(4)————简单谈谈ios程序界面实现的三种方式(代码创建,xib和storyboard)
- 纯代码的方式 通过storyboard文件创建 xib的方式创建
- iOS 关于使用xib创建cell的两种初始化方式
- ios-day11-02(控制器的多种创建方式。init方法创建、通过storyboard的创建、通过xib创建)
- iOS 关于使用xib创建cell的两种初始化方式
- 这里总结一下collection cell的三种创建方式的相关步骤,原形cell,xib,代码;还有对collection view的数据流flowlayout属性与collectionview的头底
- xib下这种方式创建cell
- 通过storyboard和xib创建控制器的方式
- iOS UICollectionView的使用(用storyboard和xib创建)
- Xcode6.1创建仅xib文件无storyboard的hello world应用
- tableview group cell xib创建,点击刷新高度+2的问题
- 从storyboard与xib中加载与手动代码创建调用方法顺序
- xib创建cell的两种方法
- iOS_14_tableViewController_xib创建和封装自定义cell
- Xcode6.1创建仅xib文件无storyboard的hello world应用(转)
- storyboard中用xib文件创建定制的UITableViewCell对象
- [ios]如何通过XIB 创建自定义的UIViewTableCell
- iOS学习笔记(2)--Xcode6.1创建仅xib文件无storyboard的hello world应用
- 使用xib定制uitalbeViewCell 加载方式