where to create autolayout constraints for subclassed uitableviewcell?

前端 未结 1 707
攒了一身酷
攒了一身酷 2021-01-31 11:18

I am trying to use autolayout for a uitableviewcell subclass I am creating and I would appreciate some advice on what method to put the layout constraint creation code. I have

相关标签:
1条回答
  • 2021-01-31 11:38

    You would need to update constraints like:

    -(void)updateConstraints{
     // add your constraints if not already there
     [super updateConstraints];
    }
    

    After adding your views to superview you need to call [self setNeedsUpdateConstraints] to start using them. By doing so the rendering runtime will call updateConstraints at the right time.

    0 讨论(0)
提交回复
热议问题