Cannot update UI object's frame in UITableViewCell

后端 未结 6 1973
眼角桃花
眼角桃花 2021-01-19 02:18

I have a subclassed UITableViewCell.

I need to dynamically change the frame of a UILabel.

Here\'s what I\'ve done:

- (UITableViewCell *)table         


        
6条回答
  •  一生所求
    2021-01-19 02:51

    You can not edit frame of UI object created through xib if Autolayout is on. There are two ways to do this:

    1. Disable Autolayout for that xib.

    OR

    1. Make an IBOutlet for particular NSlayout constraint attach it accordingly and update its constant property value through code and don't forget to call layOutIfNeeded appropriately on the object on which constarint is implemented or superview as per implementation.

提交回复
热议问题