-
Notifications
You must be signed in to change notification settings - Fork 1.7k
The empty view is shifted when changing the datasource #241
Comments
Try using the implementation from #182 and let me know if this fixes it. |
Hello I have tested the fix, it should be fine for tableview that has no header(or contentInset Top), so I have to add the following code inside the fix to make it fit for general case: |
Hi, I have same question with you. but my tableview is have a custom headerView. can you help me? |
@ldhios You have to implement Objective-C: - (CGFloat) verticalOffsetForEmptyDataSet:(UIScrollView *) scrollView {
return -self.tableView.tableHeaderView.frame.size.height/2.0f;
} Swift: func verticalOffset(forEmptyDataSet scrollView: UIScrollView!) -> CGFloat {
guard let tableHeaderView = self.tableView.tableHeaderView else { return 0 }
return tableHeaderView.frame.height/2
} |
@mathebox what about UICollectionView? |
@anirudhamahale Since it's already been 4 years, I can't really tell. Not sure how supplementary views will effect this. But I'm sure that there will be a way to account for the offset. FYI: I personally have moved to using an own implementation for UITableView and UICollectionView. |
I have one tableview with a tab to switch between 2 datasources, the first datasource have 10 items, the second datasource have no item.
the steps to reproduce the issue were:
I have tried both custom view and basic title with no luck.
Please let me know if you need any more details. Thanks.
The text was updated successfully, but these errors were encountered: