Template for missing data in a section in a View / TableView collection

I'm reflecting on what is the recommended way to display a notification that there is no data for a particular section in the ViewView / TableView collection.

One way is to create a special cell and place it instead of data cells. This seems strange, because the "empty notification" cell does not correlate with the data, which means that I will need to propagate a lot of conditions in didSelectItem, setting up the cell, etc.

Using https://github.com/dzenbot/DZNEmptyDataSet only works when the whole view is empty, and not in a specific section

Another way would be (what I'm doing now) to insert a UIView in the place where the data will be as a collection subview, but it will also require maintenance when reloading the data, scrolling, clicking. In addition, this requires calculating the placement of the view, which means that I need to change it for the collection, since it is not part of the viewviewlayout collection

Is there a recommended pattern to deal with these situations?

+4
source share
2 answers

Perhaps you should not have this section at all if the section contains empty data. Reduce the number of sections by 1 with the - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableViewdata source method and double-check the cell that will be displayed during the - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPathdata source method.

0

, "" , , .. , tableView , .

" " " " , , , , .

, tableViews , , , .

0

Source: https://habr.com/ru/post/1589140/


All Articles