Forum Xamarin.iOS

UITableView Custom Cell Question

Lainio47Lainio47 USMember ✭✭

Hi everyone,

while reading https://developer.xamarin.com/guides/ios/user_interface/tables/part_3_-_customizing_a_table's_appearance/ where you design your custom cell via CODE, I started asking how to increase the Height of a Row

Mentioned here:Click that the tutorial requires that the custom cell is created at designer.

So how can I increase the Height of a cell programmatically?

Best Answer

  • ashalvaashalva GEMember ✭✭✭
    edited July 2016 Accepted Answer

    Yes you should set it from UITableViewController, you can set the custom size e.g

    TableView.RowHeight = 70;

Answers

  • ashalvaashalva GEMember ✭✭✭

    @Lainio47,

    From your viewcontroller, set tableview.RowHeight property.

  • Lainio47Lainio47 USMember ✭✭

    I have set TableView.RowHeight = UITableView.AutomaticDimension; inside the UITableViewController is that right?

  • ashalvaashalva GEMember ✭✭✭
    edited July 2016 Accepted Answer

    Yes you should set it from UITableViewController, you can set the custom size e.g

    TableView.RowHeight = 70;

  • JF.0444JF.0444 USMember ✭✭✭

    setting RowHeight = UITableView.AutomaticDimension
    will use the auto layout to determine the size. This is based on your view's constraints. If you have not laid them out correctly everything might look collapsed when running the app. If you want to use UITableView.AutomaticDimension then you need to make sure all constraints are laid out properly. Otherwise you can override the GetHeightForRow in your tableViewSource class for dynamic sizing or TableView.RowHeight = some constant to have a fixed size for all rows.

Sign In or Register to comment.