Dynamically set the Cell height for ios
-(UITableViewCell *) tableView :( UITableView *) tableView cellForRowAtIndexPath :( NSIndexPath *) indexPath {
Self. mainTitle = [[UILabel alloc] init];
Self. mainTitle. numberOfLines = 0;
Self. mainTitle. font = [UIFont fontWithName: @ "Hiragino Sans GB" size: 14];
Self. mainTitle. text = cell_info.title;
Self. mainTitle. textColor = [UIColor grayColor];
CGSize titleSize = [self. mainTitle. text boundingRectWithSize: CGSizeMake ([UIScreen mainScreen]. bounds. size. width-20, 0) options: NSStringDrawingUsesLineFragmentOrigin attributes: @ {NSFontAttributeName: self. mainTitle. font} context: nil]. size;
Self. rowHeight = titleSize. height;
Self. mainTitle. frame = CGRectMake (15, 3, titleSize. width, titleSize. height );
[Cell. contentView addSubview: self. mainTitle];
CGRect cellFrame = [cell frame];
CellFrame. origin = CGPointMake (0, 0 );
CellFrame. size. height = self. mainTitle. frame. size. height + 5 + self. imgOne. frame. size. height + 5;
[Cell setFrame: cellFrame];
Return cell;
}
-(CGFloat) tableView :( UITableView *) tableView heightForRowAtIndexPath :( NSIndexPath *) indexPath {
If (indexPath. section = 0 ){
Return 160;
}
Else {
// If (indexPath. row = 0 ){
// UITableViewCell * cell = [self tableView: self. tableView cellForRowAtIndexPath: indexPath];
// Return cell. frame. size. height;
//}
UITableViewCell * cell = [self tableView: self. tableView cellForRowAtIndexPath: indexPath];
Return cell. frame. size. height;
}
}