[Solved] custom tableviewcell and autolayout


You can definitely use any kind of UIView without using IB, this includes a UITableViewCell. What you could do is in your

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

method, you can configure all the constraints, you can set every single subview that you want for your tableview to CGRectZero, and add them to the cell’s contentView, the cells contentView, will automatically have the proper size based on the tableview size and the insets. Therefore after adding all your subview to the content view like this inside your initWithStyle:

[self.contentView addSubview:mySubview]

you can call your own private method like configureConstraintsMyCustomTableViewCell, and configure all the constraints there.

5

solved custom tableviewcell and autolayout