cell嵌套UICollectionView是項(xiàng)目中常用的一種功能這篇文章其實(shí)只有一個(gè)知識(shí)點(diǎn) 就是如何根據(jù)數(shù)據(jù)源數(shù)量的多少來動(dòng)態(tài)布局UICollectionView
- 對(duì)Masonry布局不太熟悉的哥們 可以搜下 標(biāo)哥的技術(shù)博客
- 為了不要每次計(jì)算cell的高度,最好的模型中添加一個(gè)高度的屬性
@interface HomeModel : NSObject
@property (nonatomic,copy)NSString *icon;
@property (nonatomic,copy)NSString *contentText;
@property (nonatomic,assign)CGFloat cellHeight;
@property (nonatomic,copy)NSArray *dataArray;
@end
回到正題
在下面這個(gè)數(shù)據(jù)源中調(diào)用cell中自定義的刷新方法 ,詳細(xì)代碼查看demo
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
[cell reloadData:model];
}