Grouped UITableView shows blank space when section is empty

后端 未结 11 592
别跟我提以往
别跟我提以往 2020-12-30 23:44

I have a grouped UITableView where not all sections may be displayed at once, the table is driven by some data that not every record may have. My trouble is that the record

11条回答
  •  佛祖请我去吃肉
    2020-12-31 00:05

    In the above screenshot, is your numberOfSectionsInTableView: method returning a value of 5? And then is your getRowCount: method (called from numberOfRowsInSection:) returning a value of 0 for those "missing" sections (e.g. 1, 3 and 4)?

    If you don't want gaps in between, the likely solution is to only declare the number of sections you want to be visible. In your example above, you'd only want to return value of 3 from numberOfSectionsInTableView:.

提交回复
热议问题