How to hide empty UITableViewCells displayed in UITableView with simple style - iOS?

UItableView shows empty rows as shown below.

enter image description here

how to hide it without changing the style of the table. Is it necessary to resize the View table, if so, how can I accurately determine the height.

+4
source share
5 answers

you add UIview to uitabeview footer using xib or tableview delegate method

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section; { return 1; } - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section; { return yourview; } 
+4
source
 self.tableView.tableFooterView = [[UIView alloc] init]; 
+6
source

What I did in one of my projects was to set the table background color for clearColor and the separator to none.

0
source

Just drag the view from the object library to the empty TableView wrapper in the storyboard. Make the presentation as the footer of the table view (in the outline of the document, drag it under the cell, if it is not already at the bottom), make the height of the view "0". You will not see the view in the storyboard because its height is "0", but when it starts, it will hide cells. I think this should work.

0
source

Why don't you add some logic to

 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 

function?

Just return the number of cells that are really filled with data

-1
source

All Articles