Guest User

Untitled

a guest
Jan 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. tableView.estimatedRowHeight = 83.0
  2. tableView.rowHeight = UITableViewAutomaticDimension
  3.  
  4. -(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(nonnull NSIndexPath *)indexPath
  5. {
  6. return UITableViewAutomaticDimension;
  7. }
  8.  
  9. self.tableView.estimatedRowHeight = 60; // required value.
  10.  
  11. UILabel * label = [UILabel new];
  12. [self.contentView addSubview:label];
  13. NSDictionary * views = NSDictionaryOfVariableBindings(label);
  14. //Inset 5 px
  15. [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-5-[label]-5-|" options:0 metrics:nil views:views]];
  16. [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-5-[label]-5-|" options:0 metrics:nil views:views]];
  17. // height >= 44
  18. [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.mainLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:44.0]];
Add Comment
Please, Sign In to add comment