dev-liyang / lyemptyview Goto Github PK
View Code? Open in Web Editor NEWiOS一行代码集成空白页面占位图(无数据、无网络占位图) emptyView-empty set
License: MIT License
iOS一行代码集成空白页面占位图(无数据、无网络占位图) emptyView-empty set
License: MIT License
描述:
tableview空页面,不采用reloadData方式刷新数据源,而使用insertRowAtIndexPath插入一条,emptyView没有hidden。
场景:
采用wiki 6.延迟显示emptyView方式
问题验证:
修改insertRowAtIndexPath为reloadData可修复
代码:
[self.dataArray insertObject:obj atIndex:0];
[self.tableView beginUpdates];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow: 0];
[self.tableView insertRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
设置autoShowEmptyView为NO后,[tableView ly_showEmptyView];
必须放在[tableView reloadData];
后面处理,否则reloadData时会隐藏。
自定义的视图emptyViewWithCustomView如果是tableView ,tableView的cell点击事件不走代理方法
只有统一设置subViewMargin 间距,比如我要设置标签和图片间距是10 ,标签和按钮的间距是50这样就没办法了
ios 8.4 上测试时,碰到UIAlertController弹出时都会出错。在ios8.2上和ios10上测试正常
应该多增加一个 通过否判断存在组头部,来控制显示隐藏的 好一点,现在这种情况 只能手动的显示隐藏
有一个页面我没使用到emptyview,我在那个页面执行insertrow方法是还进行交换了,请问这个怎么避免
看demo上都是添加一个按钮点击重试,或点击contentView重试,有没有点击屏幕重试方法
设置 self.tableView.ly_emptyView.autoShowEmptyView = NO;
然后在tableView reloadData 之后设置[self.tableView ly_endLoading];
刷新的时候tableView闪动是怎么回事
`
let v = UIView()
let iv = UIView()
v.addSubview(iv)
// 只要CustomView添加了约束就会卡死主线程?
iv.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
}
let ev = LYEmptyView.emptyView(withCustomView: v)
tableView.ly_emptyView = ev
`
在iOS13 系统,在App进入后台然后在回到前台会,导致CPU达到100%,具体问题位置没定位出来
我自定义的MyDIYEmpty继承于 LYEmptyView, 然后 MyDIYEmpty 调用emptyViewWithCustomView方法封装, ios11正常, ios9和ios10 会卡死. 项目比较近,没时间研究是哪里的问题, 我就自己判断展位页面显示和隐藏.
可以在setSubViewFrame方法中加上这个(uicollectionview同理):
//有无设置偏移
if (self.contentViewOffset) {
self.ly_centerY += self.contentViewOffset;
}else{
if ([self.superview isKindOfClass:[UITableView class]]) {
UITableView *tableView = (UITableView *)self.superview;
self.ly_centerY -= tableView.contentInset.top;
}
}
//有无设置Y坐标值
if (self.contentViewY < 1000) {
self.ly_y = self.contentViewY;
}else{
if ([self.superview isKindOfClass:[UITableView class]]) {
UITableView *tableView = (UITableView *)self.superview;
self.ly_centerY -= tableView.contentInset.top;
}
}
每次一进入tableView界面,先显示空白页,数据返回之后空白页才自动隐藏
OneCodeViewController文件已删除,但是没有从project中remove掉引用
1.自己遇到的情况是,用了这个之后,提交审核不通过
2.删除之后就审核通过了
拒绝审核通过的原因是:
Your app, extension, or linked framework appears to contain code designed explicitly with the capability to change your app’s behavior or functionality after App Review approval, which is not in compliance with App Store Review Guideline 2.5.2 and section 3.3.2 of the Apple Developer Program License Agreement.
This code, combined with a remote resource, can facilitate significant changes to your app’s behavior compared to when it was initially reviewed for the App Store. While you may not be using this functionality currently, it has the potential to load private frameworks, private methods, and enable future feature changes. This includes any code which passes arbitrary parameters to dynamic methods such as dlopen(), dlsym(), respondsToSelector:, performSelector:, method_exchangeImplementations(), and running remote scripts in order to change app behavior and/or call SPI, based on the contents of the downloaded script. Even if the remote resource is not intentionally malicious, it could easily be hijacked via a Man In The Middle (MiTM) attack, which can pose a serious security vulnerability to users of your app.
Next Steps
To resolve this issue, please perform an in-depth review of your app and remove any code, frameworks, or SDKs that fall in line with the functionality described above and resubmit your app’s binary for review.
有个需求:当前页面进来时无数据展示了无数据的图片,但是关掉网络后,重新加载之后应该显示无网络的图片,但是tableView创建的时候给ly_emptyView赋值时已经决定了空视图的样子,所以我想问一下能不能再每次刷新的时候再访问该展示什么内容。我看DZNEmptyDataSet是用代理来做的,但是不太想用那个,各种代理写一大堆。
你好我这为啥搜不到?
Mac:~ gxz$ pod --version
1.4.0
Mac:~ $ pod search LYEmptyView
[!] Unable to find a pod with name, author, summary, or description matching LYEmptyView
当collectionView的contentInset的left边距大于0时,emptyView不居中,貌似只考虑left没考虑right?
如题,没用到emptyview的页面也收到影响了,方法互换不能乱用
在其他系统上是正常的
ly_startLoading 网络加载时 采用的方法 看心情生效
let emptyLabel = UILabel()
emptyLabel.text = "暂无查询内容"
emptyLabel.font = UIFont.systemFont(ofSize: 14)
emptyLabel.textColor = colorWithHexString(hex: "CCCCCC")
collection.ly_emptyView = LYEmptyView.emptyView(withCustomView: emptyLabel)
view.addSubview(collection)
这样添加没有用吗
原因是actionBtnCornerRadius
设置为 0 后
CGFloat cornerRadius = self.actionBtnCornerRadius ? self.actionBtnCornerRadius : 5.f;
这行代码会走 false 逻辑。
CUICatalog: Invalid asset name supplied: (null)
自定空页面 报错
UIView * contentView = [[UIView alloc] init];
contentView.frame = CGRectMake(0, 0, 100, 100);
contentView.backgroundColor = [UIColor redColor];
没加子视图没问题,添加子视图报错
// UILabel * titleLab = [[UILabel alloc] init];
// titleLab.text = titleStr;
// titleLab.font = FONT_MAIN;
// titleLab.textColor = COLORF_MAIN;
// [contentView addSubview:titleLab];
// [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
// (void)make.centerX.centerY;
// }];
//
// UILabel * desLab = [[UILabel alloc] init];
// desLab.text = detailStr;
// desLab.font = FONT_MAIN;
// desLab.textColor = COLORF_MAIN;
// [contentView addSubview:desLab];
// [desLab mas_makeConstraints:^(MASConstraintMaker *make) {
// (void)make.centerX;
// make.top.mas_equalTo(titleLab.mas_bottom);
// }];
inView.ly_emptyView = [LYEmptyView emptyViewWithCustomView:contentView];
_scrollView.ly_emptyView = [LYEmptyView emptyActionViewWithImageStr:@"net"
titleStr:@"无数据" detailStr:@"查看网络设置,稍后再试!"
btnTitleStr:@"重新加载"
target:self
有数据的时候,也是显示在背后!
self.view.ly-empty 这个。ly后面的我根本就调不出来,我导入了头文件,按demo写,就是不能成功,作者能解释下哪里控制这个?
如题
如题,wkwebview也有加载进度的支持了,如果能支持;我觉得框架会更强大。我现在在扩展你的框架,如果我能写好,给你pull可以不?
我也搜不到
MR_THT$ pod --version
1.3.1
Mac:~ $ pod search LYEmptyView
[!] Unable to find a pod with name, author, summary, or description matching LYEmptyView
使用情况是,我用图片直接进行的初始化,所以图片字符串直接就是nil了,于是就会出现这个警告,CUICatalog: Invalid asset name supplied: '(null)',看源码后发现是LYEmptyView.m文件的setupSubviews方法中,进行图片初始化时的这段代码
//占位图片 UIImage *image = [UIImage imageNamed:self.imageStr]; if(self.image){ [self setupPromptImageView:self.image]; }else if (image) { [self setupPromptImageView:image]; } else{ if (_promptImageView) { [self.promptImageView removeFromSuperview]; self.promptImageView = nil; } }
在这个里面,self.imageStr为nil,所以报了这个警告,暂时不影响运行,只有警告。如果这儿可以加上一个对于self.imageStr为空的检测,就更好了,可以消除掉这个警告。目前如果要消除这个警告,只能用图片名称字符串来初始化才行。
貌似和MJRefresh冲突了,导致添加占位视图刷新数据时mj_reloadData和ly_reloadData都没执行
0 | CoreFoundation | __exceptionPreprocess |
---|---|---|
1 | libobjc.A.dylib | objc_exception_throw |
2 | CoreFoundation | +[NSException raise:format:] |
3 | Foundation | -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] |
4 | UIKit | -[UICollectionViewData indexPathForItemAtGlobalIndex:] |
5 | UIKit | -[UICollectionViewData layoutAttributesForGlobalItemIndex:] |
6 | UIKit | -[UICollectionView _viewAnimationsForCurrentUpdate] |
7 | UIKit | __71-[UICollectionView _updateWithItems:tentativelyForReordering:animator:]_block_invoke.1983 |
8 | UIKit | +[UIView(Animation) performWithoutAnimation:] |
9 | UIKit | -[UICollectionView _updateWithItems:tentativelyForReordering:animator:] |
10 | UIKit | -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:] |
11 | UIKit | -[UICollectionView _updateRowsAtIndexPaths:updateAction:] |
[framework] CUICatalog: Invalid asset name supplied: '(null)'
自定义的 视图 emptyView(withCustomView: ) image 应该可以为空的
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.