iOS开发总结之自定义等高cell03-xib
来源:互联网 发布:heading标签优化 编辑:程序博客网 时间:2024/05/17 01:56
1.nib中的结构
2.代码封装上面的cell
#import "XMGDealsViewController.h"#import "XMGDeal.h"#import "XMGDealCell.h"@interface XMGDealsViewController ()/** 所有的团购数据 */@property (nonatomic, strong) NSArray *deals;@end@implementation XMGDealsViewController- (NSArray *)deals{ if (_deals == nil) { // 加载plist中的字典数组 NSString *path = [[NSBundle mainBundle] pathForResource:@"deals.plist" ofType:nil]; NSArray *dictArray = [NSArray arrayWithContentsOfFile:path]; // 字典数组 -> 模型数组 NSMutableArray *dealArray = [NSMutableArray array]; for (NSDictionary *dict in dictArray) { XMGDeal *deal = [XMGDeal dealWithDict:dict]; [dealArray addObject:deal]; } _deals = dealArray; } return _deals;}- (void)viewDidLoad { [super viewDidLoad]; // UINib *nib = [UINib nibWithNibName:NSStringFromClass([XMGDealCell class]) bundle:nil];// [self.tableView registerNib:nib forCellReuseIdentifier:@"deal"];// [self.tableView registerClass:[XMGDealCell class] forCellReuseIdentifier:@"deal"];}- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}#pragma mark - Table view data source- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.deals.count;}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // 创建cell XMGDealCell *cell = [XMGDealCell cellWithTableView:tableView]; // 取出模型数据 cell.deal = self.deals[indexPath.row]; return cell;}@end
效果:
0 0
- iOS开发总结之自定义等高cell03-xib
- iOS开发总结之自定义非等高cell-xib(方法一)
- iOS开发总结之自定义等高cell-storyboard
- iOS开发总结之自定义非等高cell-storyboard
- iOS开发总结之自定义等高cell02-storyboard(封装)
- iOS开发:XIB之UITableView自定义cell
- iOS开发:xib之UICollectionView自定义cell
- 自定义等高的cell(使用XIB)
- tableView - 自定义等高cell-xib方式
- 自定义等高的cell(xib)
- xib自定义非等高的cell
- 自定义非等高cell01-xib
- 自定义非等高cell02-xib
- IOS开发学习之自定义XIB的使用
- IOS开发(97)之自定义视图之使用XIB自定义一个UIView
- IOS开发-15.自定义cell(等高cell)
- UI 一一 自定义等高cell (XIB方式)
- IOS开发 使用XIB自定义一个UIView
- 如何确定函数依赖和其作用
- 其他浏览器均正常显示,uc不显示效果
- 可以免费自学编程的12个网站
- node.js在webstorm 11中的调试
- Android-BroadcastReceiver详解
- iOS开发总结之自定义等高cell03-xib
- OpenCV学习笔记(六)(七)(八)(九)(十)
- Nodejs数据流(Stream)手册
- MyEclipse项目下jquery文件报错
- Aizu 2224 Save your cats【最大生成树】
- 黑马程序员基础评测:Java编程基础
- 使用struct ifreq实现ifconfig
- VPN server 配置(http://my.oschina.net/isnail/blog/363151)
- MJRefresh实现刷新(使用它的Block方法)