Dynamically increase height of UILabel & TableView Cell?

First of all you should not calculate height manually in auto layout environment. Just set both labels TopSpace and BottomSpace to cell’s contentView and make sure you set both labels NumberOfLines to 0 and LineBreakMode to WordWrap. And the other constraint are as below, ItemLabel: SeparatorView: DescriptionLabel: And add the delegates for height as below, … Read more

How do I databind a ColumnDefinition’s Width or RowDefinition’s Height?

Create a IValueConverter as follows: public class GridLengthConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { double val = (double)value; GridLength gridLength = new GridLength(val); return gridLength; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { GridLength val = (GridLength)value; return val.Value; } } You can … Read more

Dynamic Height Issue for UITableView Cells (Swift)

Try This: func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { return UITableViewAutomaticDimension } EDIT func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { return UITableViewAutomaticDimension } Swift 4 func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { return UITableViewAutomaticDimension } Swift 4.2 func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { return … Read more

Setting custom UITableViewCells height

Your UITableViewDelegate should implement tableView:heightForRowAtIndexPath: Objective-C – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return [indexPath row] * 20; } Swift 5 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return indexPath.row * 20 } You will probably want to use NSString‘s sizeWithFont:constrainedToSize:lineBreakMode: method to calculate your row height rather than just performing some silly … Read more