美文网首页
cell.contentView.frame.height与he

cell.contentView.frame.height与he

作者: James_blunt | 来源:发表于2017-09-05 13:45 被阅读0次

开发的时候,小伙伴可能会遇到这个问题

在这个方法里面设置cell子视图的frame会经常与预期的不符

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

   self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];

   if (self) {

    //在这里设置与预期不符,因为cell默认的高度44的关系。也就是说读取到的cell.frame.size.height是44,而不是cell的实际高度

   return self;

}

-(void)layoutSubviews{

    //在这里读取的就是实际cell的高度了。即在这里获取cell的高度与vc里heightForRowAtIndexPath设置的告诉是一样的

}

注:不喜勿喷,如有错误,或者更好的方法,联系我哟~~from Erdi

相关文章

  • cell.contentView.frame.height与he

    开发的时候,小伙伴可能会遇到这个问题 在这个方法里面设置cell子视图的frame会经常与预期的不符 - (ins...

  • He can he up and He do it!

    01 不知道能做成什么样子的时候,只管去做就对了。 爱情片,看内容;商业片,看品格;文艺片,看情怀;动作片,看制作...

  • 返璞归真,剑走偏锋——HIFIMAN Arya录音师版平板耳机评

    在HIFIMAN的产品线中,Arya录音师版最让我感到神秘与惊喜。HE5se、HE6se、HE1000se,以及j...

  • He

    回家的列车徐徐开启,在半夜补了一张卧铺票,15号中铺,下铺是一个高大威猛,什么都收拾的很妥帖的一个人,在看书?好奇...

  • HE

    I like my head teacher best in my junior high school.He i...

  • he

    why you stare at me without a word ?

  • He

    Found my every lost back but u u come everything goes alive

  • He

    我最好的女朋友蒋一霓砸了我的酒吧门牌消息发到我手机里的时候,我正跟孔阕陵在俱乐部小房间里厮混。 他不久前换了造型,...

  • He

    Want to see you again.❤️

  • He

    Need or not ---all for a broken heart Please open...

网友评论

      本文标题:cell.contentView.frame.height与he

      本文链接:https://www.haomeiwen.com/subject/xvrujxtx.html