I’m following the concept mention in https://stackoverflow.com/a/18746930 but slightly in different way to implement the dynamic cell using auto layout. I have only one prototype custom cell. But I have to add multiple UILabel to the cell based on data array and have to maintain the dynamic cell height.
//My UITableViewCell
@interface CustomCell ()
@property (nonatomic, assign) BOOL didAddLabel;
@end
@implementation CustomCell
- (void)awakeFromNib {
    [super awakeFromNib];
}
-(void)addLabel:(NSArray*)someAry{
    if(!didAddLabel){
        for (int i=0; i<someAry.count; i++) {
            // Initialize UILabel Programtically ...
            // adding label
            [self.aViewOfContaintView addSubview:aLabel];
        }
        self.heightLayoutConstraintOfaViewOfContaintView.constant = value;
        [self.aViewOfContaintView layoutIfNeeded];
        self.didAddLabel = YES;
    }
}
@end
//My UIViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    //.. .. ..
    self.tableView.rowHeight = UITableViewAutomaticDimension;
    self.tableView.estimatedRowHeight = 100;
    //.. .. ..
}
- (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    CustomCell *cell = (CustomCell *)[theTableView dequeueReusableCellWithIdentifier:CellIdentifier];
    // Configure the cell for this indexPath
    //.. .. ..
    //Add Label
    [cell addLabel:anAry];
    [cell layoutIfNeeded];
    return cell;
}
if I don’t use that checking didAddLabel, then scrolling table sticking. If I use that then only I get four cells of distinct height.
the above answer mentions “For every unique set of constraints in the cell, use a unique cell reuse identifier. …”
How to use/register different reuse identifiers to same custom cell? Any alternative solution or any help will be appreciated.
 
     
    