-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
大佬,每次点击都要重建好像有点浪费性能啊 #20
Comments
这个只是示例代码,是否每次新建实例,结合你的实际需求来决定。 |
具体来说,我想在一个页面只创建一次pbViewController,比如我上面那样的写法,但是出现了第二次及以后显示图片位置靠下的问题,而且只能上下滑动消失一次,以后就不能滑动消失了,滑动的这一次还会让图片位置变动,目前已经换回了每次显示图片都new一个pbViewController的写法,不过就使用上来说,现在这样完全可以了,等你有空了再看吧 |
好的,大佬。 |
cuzv大神,很喜欢你写的PhotoBrowser,我也和kilent有同样的顾虑,每次点击都新建的话还是有额外性能开销的,UIAlertController因为很轻,所以没有什么关系,但如果是UITableView的话往往是会reload的。 |
能省多少性能,具体数值我也不了解,只是习惯这么写:
if (!pbViewController) { pbViewController = [PBViewController new]; pbViewController.pb_dataSource = self; pbViewController.pb_delegate = self; } pbViewController.pb_startPage = indexPath.item;
但是发现会有问题,只好去掉了if
The text was updated successfully, but these errors were encountered: