sbmandav sbmandav - 6 months ago 9
iOS Question

how to hide empty rows in a UITableView and change the height of the Uitableview based on non-empty rows

I have couple of problems with my

UITableView
.


  1. When I add a
    UITableview
    on my page, by default it brings up some fixed number of rows,
    even though I set number of rows in section as
    1
    . All the rows appear except the first row, and all are empty rows. So, I want to hide all the empty rows in the
    UItableview
    .

  2. Based on the non-empty rows, I want to change the height of my
    UItableView
    .


Answer

You sure you are using UITableViewStyleGrouped style?

Because by default it is set to UITableViewStylePlain which shows empty cells too after displaying filled cells.