DZNEmptyDataSet
DZNEmptyDataSet copied to clipboard
extra verticalOffsetForEmptyDataSet: after -reloadData
I use custom view for loading view case
- (UIView *)customViewForEmptyDataSet:(UIScrollView *)scrollView
{
if (! self.viewModel.loading) {
return nil;
}
UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:
UIActivityIndicatorViewStyleWhiteLarge];
[activityView startAnimating];
return activityView;
}
and default view for empty state view.
Both have vertical offset
- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
{
CGFloat offset = CGRectGetHeight(self.navigationController.navigationBar.frame);
offset += CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);
if (! self.viewModel.loading) {
offset += 72.f;
}
return -offset;
}
Also, I reload table to change empty placeholder from custom activity to empty placeholder
- (void)initialBind
{
[RACObserve(self, viewModel.loading) subscribeNext:
^(id _Nullable __unused _) {
[self.tableView reloadData];
}];
}
As result, I got sum of both vertical offsets.
...So I forsed to do hotfix like that:
- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
{
CGFloat offset = CGRectGetHeight(self.navigationController.navigationBar.frame);
offset += CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);
if (! self.viewModel.loading) {
offset *= 2; // !!! <== HOTFIX
offset += 72.f; // actually I need only this
}
return -offset;
}
Read #147