Last active
August 29, 2015 14:19
-
-
Save yuxiangq/6c282d9899fe28fe59e4 to your computer and use it in GitHub Desktop.
prototypeCustomCell的初始化
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//仅展示部分代码 | |
@interface ViewController () | |
/** | |
* 原型cell | |
*/ | |
@property (strong,nonatomic) CustomCell *prototypeCustomCell; | |
/** | |
* 数据源 | |
*/ | |
@property (strong,nonatomic) NSArray *dataArray; | |
@end | |
- (void)viewDidLoad{ | |
[super viewDidLoad]; | |
//... | |
[self.tableView registerClass:[CustomCell class] forCellReuseIdentifier:kCustomCellIdentifier]; | |
self.prototypeCustomCell=[self.tableView dequeueReusableCellWithIdentifier:kCustomCellIdentifier]; | |
} | |
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | |
[self.prototypeCustomCell configurationCell:self.dataArray[indexPath.row]]; | |
[self.prototypeCustomCell setNeedsLayout]; | |
[self.prototypeCustomCell layoutIfNeeded]; | |
CGFloat height=[self.prototypeCustomCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height+1; | |
return height; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment