2.。。。。重载如下方法也无法达到修改效果
//-(void)layoutSubviews
//{
// [self layoutSubviews];
// [self UpdateUI];
//}
}3.。。。。。。。。3.这个方法最好 对视图的修改方法可以解决 - (void)drawRect:(CGRect)rect { [self updateUI]; }// 更新视图的方法 这个视图要再哪里调用 我们这里分析下1.2.3 - (void)updateUI { _headermag.layer.cornerRadius = 20; _headermag.layer.masksToBounds = YES; _looklabel.numberOfLines = 2; _looklabel.textAlignment = NSTextAlignmentRight; } - (void)setContentsmodel:(ContentsModel *)contentsmodel {1.。。。。。。1.尝试过在此次对里面的子视图进行修改,但初次显示的内容尺寸无法修改,当这个cell被重用时可以达到修改效果,也深度在此时通过定时器延时进行修改,可解决,可有时会有延时的效果,不完美... 在这里就赋值就好了 但是对子视图控件有需要修改的地方这里不是最优的 _contentsmodel = contentsmodel; [_headermag sd_setImageWithURL:[NSURL URLWithString:_contentsmodel.creator.portrait] placeholderImage:[UIImage imageNamed:@"tab_me_p"]]; _namelabel.text = _contentsmodel.creator.nick; _citylabe.text = _contentsmodel.city; [_bigmag sd_setImageWithURL:[NSURL URLWithString:_contentsmodel.creator.portrait] placeholderImage:[UIImage imageNamed:@"tab_me_p"]]; }在controller里面可以这么实现
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { FavoriteItemCell *cell = [tableView dequeueReusableCellWithIdentifier:@"FavoriteItemCell"]; if (cell == nil) { cell = (FavoriteItemCell *)[[NSBundle mainBundle] loadNibNamed:@"FavoriteCell" owner:self options:nil][0]; } cell.model = _arrayOfData[indexPath.section]; return cell; }
转载于:https://www.cnblogs.com/wangxiaoqi/p/6430889.html
相关资源:数据结构—成绩单生成器