Open summertian4 opened 7 years ago
I know I can use - (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
. But this need some calculation. How about give a simple interface like frameInSuperView
.
最近遇到了同样的问题,origin.y 不易控制 ,看源码是 原生AutoLayout布局的 甚是纠结
@summertian4 找个了个笨方法,直接上 代码吧 是Masonry布局的.在View的子类中,重写layoutSubviews,这样纸以后 CustomView会充满全屏,然后 里边的布局 就自己弄哈
-(void)layoutSubviews{
[super layoutSubviews];
// 状态栏高度
CGFloat statusHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
// 导航栏高度
CGFloat naviHeight = self.viewController.navigationController.navigationBar.frame.size.height;
// tabbar高度
CGFloat tabbarHeight = self.viewController.tabBarController.tabBar.frame.size.height;
// view 高度
CGFloat viewHeight = self.viewController.view.frame.size.height;
CGFloat fullScreenHeight = viewHeight - naviHeight - statusHeight - tabbarHeight;
if (self.height != fullScreenHeight) {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(fullScreenHeight);
}];
}
}
今天又发现 如果是 包含了刷新控件,比如说 MJRefresh 需要 verticalOffsetForEmptyDataSet 加上 header造成的 偏移量 self.scrollview.mj_header.height ,再就是 如果 是 UICollectionView的话 再加 7.5的偏移量
我暂时给 DZNEmptyDataSet
加了一个 category,添加一个计算偏移量的方法。
我想问下如何在非首次刷新检测是否为空 数据加载未完成显示占位图的情况
Can DZNEmptyDataSet support custom elements position if i don`t want EmptyView default in the middle.
Sometimes, our UI designer has such a requirements:
Please add some interface.