quintgao / gkphotobrowser Goto Github PK
View Code? Open in Web Editor NEWiOS仿微信、今日头条等图片浏览器
License: MIT License
iOS仿微信、今日头条等图片浏览器
License: MIT License
第一次打开是可以通过收回正常隐藏Controller的,缩放后无法收回,只能通过点击收回
如题
双击放大后,单击退出,再单击小图进入的时候有问题.图片会晃动一下,可能是原来的放大没还原
就是付费图片会有一张遮罩
楼主,你的那个UIScrollView+GKGestureHandle建议不要添加,会影响app,导致滑不动
GKPhotoBrowser在关闭之后,没有dealloc,被循环引用了。
集成之后,tableView的下拉就会失效,拉不动
你这样写category操作系统级别的api,很容易出问题啊
UIScrollView+GKGestureHandle.m
第 24行 #pragma mark - 解决全屏滑动
请问
isScrollViewOnTopOrBottom
为何要返回NO
今日头条图片放大模式下,点击,图片缩放有问题
能否给一个接口来修改图片展示区域的大小
默认是适应全屏幕的话
甚至会挡住countlabel
你好。因为我工程的Other Linker Flags使用了-all_load,所以即便没有直接调用UIScrollView+GKGestureHandle.h里面的方法,也会使得UITableView下拉失效,请问应该怎么解决?
显示GIF 内存占用高达一个G多 CPU一百多
GKPhoto是否考虑添加PHAsset
GKPhotoView的loadImageWithPhoto:添加PHAsset方法异步加载图片的,
这样在选择相册图片,浏览图片可以先不要同步获取图片URL信息,
双击放大手势的操作里面有一个判断:
- (void)handleDoubleTap:(UITapGestureRecognizer *)tap {
GKPhotoView *photoView = [self photoViewForIndex:self.currentIndex];
GKPhoto *photo = self.photos[self.currentIndex];
if (!photo.finished) return;
但是直接通过本地加载图片设置GKPhoto时,finished总是为NO:
GKPhoto *photo = [GKPhoto new];
photo.image = [UIImage imageNamed:obj];
所以造成此问题。需要优化下
您好,GKWebImageProtocol为什么一定要强引用(一般代理都是弱引用,这里的区别对比),我尝试了改为弱引用,图片就会一直在加载中
比如都是高清大图,是不是可以剪裁一下图片
'FLAnimatedImage/FLAnimatedImage.h' file not found
最新版不会自动导入 FLAnimatedImage,pod 'GKPhotoBrowser', '~> 1.2.2'
就可以
作者,你好!
我修改以下方法,变成导航控制器,缩放返回的时候,背景不透明了
(void)showFromVC:(UIViewController *)vc {
self.fromVC = vc;
// if (self.showStyle == GKPhotoBrowserShowStylePush) {
// [vc.navigationController pushViewController:self animated:YES];
// }else {
// self.modalPresentationCapturesStatusBarAppearance = YES;
// [vc presentViewController:self animated:NO completion:nil];
// }
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:self];
[vc presentViewController:nav animated:NO completion:nil];
}
首次显示的时候,滑动图片卡顿,当所有的图片都看过之后,在滑动就不卡顿了
showFromVC 这个方法需要获取某controller
若是直接在window上加的图 就无法触发了 [UIApplication sharedApplication].keyWindow.viewController 也是nil
你好,首先感谢提供这么好用的图片浏览库。
不过我们在使用的时候遇到了一共问题,就是因为gif图片都比较大,所以我们从网络获取到gif,然后加载之后,不把他存到本地,而是只放到内存了,用到了SDWebImage的这个属性SDWebImageCacheMemoryOnly。
然后配合这个库的话,就会发现当第一次的时候点击gif是会动的,而关闭再打开就静止了,不知这个库对于这种情况有什么解决办法吗?
我在使用本库时发现支持上下滑动淡出视图的功能会在zoom之后失效,通过修改源码修复了此问题, 在您的demo “tableviewcell多图zoom” 进行如下操作:即可复现
1.4.5版本加载图片时没有加载器了。打开图片链接时,加载器没有出现,黑屏,最后才出现图片。
建议增加一个browser 完全消失之后的回调
作者你好,我项目中的SD版本是pod 'SDWebImage', '~> 4.4.1',手动导入你的库。
似乎pod上面你的库是1.2.8版本,最新这边是1.3.4?
然后在GKPhotoView.m中,- (void)loadImageWithPhoto:(GKPhoto *)photo 这个方法下面
NSData *imageData = [[SDImageCache sharedImageCache] diskImageDataForKey:photo.url.absoluteString];
[strongSelf setupPhotoWithData:imageData image:image];
也就是186行左右,默认会报错,因为SDW里面找不到这个方法了。
作者是否可以尝试一下?4.4.1的SDW是我这边pod里搜到最新的了。
- (void)setupPhoto:(GKPhoto *)photo 方法会执行两次
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
GKPhoto *photo = [self currentPhoto];
GKPhotoView *photoView = [self currentPhotoView];
if ([_imageProtocol imageFromMemoryForURL:photo.url] || photo.image) {
[photoView setupPhoto:photo];
}else {
photoView.imageView.image = photo.placeholderImage ? photo.placeholderImage :
photo.sourceImageView.image;
[photoView adjustFrame];
}
switch (self.showStyle) {
case GKPhotoBrowserShowStyleNone:
[self browserNoneShow];
break;
case GKPhotoBrowserShowStylePush:
[self browserPushShow];
break;
case GKPhotoBrowserShowStyleZoom:{
[self browserZoomShow];
}
break;
default:
break;
}
}
这个里面会走两次
zoom之后恢复原图大小,无法上滑/下滑淡出 #31 这个问题我机子又出现了,GKPhotoBrowser版本1.4.8,我机子 xs 12.2
执行下面代码添加view,如view中添加scrollView、button等控件,操作时会发生手势冲突
[browser setupCoverViews:@[view] layoutBlock:^(GKPhotoBrowser *photoBrowser, CGRect superFrame) {
[self resetCoverFrame:superFrame index:photoBrowser.currentIndex];
}];
连续几张图片放大,有的图片出现问题
0 CoreFoundation | ___exceptionPreprocess + 228 |
---|---|
1 libobjc.A.dylib | objc_exception_throw + 56 |
2 CoreFoundation | -[NSCache init] |
3 QuartzCore | 0x00000001a5615000 + 1354148 |
4 QuartzCore | 0x00000001a5615000 + 1290436 |
5 QuartzCore | 0x00000001a5615000 + 1292332 |
6 UIKitCore | -[UIView(Geometry) setFrame:] + 356 |
7 UIKitCore | -[UIImageView _setViewGeometry:forMetric:] + 172 |
8 ManagePlus | 0x0000000102d18000 + 9189636 |
9 ManagePlus | 0x0000000102d18000 + 9188608 |
10 UIKitCore | -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 64 |
11 UIKitCore | __UIGestureRecognizerSendTargetActions + 124 |
12 UIKitCore | __UIGestureRecognizerSendActions + 320 |
13 UIKitCore | -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 764 |
14 UIKitCore | __UIGestureEnvironmentUpdate + 1096 |
15 UIKitCore | -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 384 |
16 UIKitCore | -[UIGestureEnvironment _updateForEvent:window:] + 204 |
17 UIKitCore | -[UIWindow sendEvent:] + 3128 |
18 UIKitCore | -[UIApplication sendEvent:] + 340 |
19 UIKitCore | ___dispatchPreprocessedEventFromEventQueue + 1620 |
20 UIKitCore | ___handleEventQueueInternal + 4740 |
21 UIKitCore | ___handleHIDEventFetcherDrain + 152 |
22 CoreFoundation | _CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24 |
23 CoreFoundation | ___CFRunLoopDoSource0 + 88 |
24 CoreFoundation | ___CFRunLoopDoSources0 + 176 |
25 CoreFoundation | ___CFRunLoopRun + 1040 |
26 CoreFoundation | CFRunLoopRunSpecific + 436 |
27 GraphicsServices | GSEventRunModal + 100 |
28 UIKitCore | UIApplicationMain + 212 |
29 ManagePlus | 0x0000000102d18000 + 9485528 |
30 libdyld.dylib | 0x00000001a0ba2000 + 2996 |
UIView+WebCache 等好多文件都没用了
作者,你好,建议可以适配下iPhoneX,🤗
GKPhotoBrowser.m中, zoomEnded中使用self, 造成循环引用, 改成weak即可
是否支持自定义“图片加载失败,请检查网络后重试”?
在图片加载失败后,这句话能不能自定义,或者使用一张“裂图”来显示。
这个问题是图片失败,但提示检查网络后重试,于理不通。
多张图片选择 ,当我点进浏览器 ,显示大图中我在这个长按收拾上增加一个删除图片的 操作,这样这图片的数据源就出现问题了
用此方法删除指定索引的图片,会出现已删除图片和新的该位置上的图片叠加(图片大小不一时一眼就能看到,大小一样是可以通过视图调试看到),而且已删除图片仍然占着位置(浏览器末尾有黑色页,删除几张就有几页)。我在resetPhotoBrowserWithPhotos方法中增加了将self.reusablePhotoViews和self.visiblePhotoViews中的[view removeFromSuperview],并在[self setupPhotoViews]后调用[self layoutSubviews],才规避。希望作者能有更好的解决方法处理此问题。
GKTest02ViewController的代码
NSMutableArray *photoArrs = [NSMutableArray new];
[photos enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
GKPhoto *photo = [GKPhoto new];
if ([obj hasPrefix:@"http"]) {
photo.url = [NSURL URLWithString:obj];
}else {
photo.image = [UIImage imageNamed:obj];
}
// photo.sourceImageView = containerView.subviews[idx];
UIWindow * window=[[[UIApplication sharedApplication] delegate] window];
UIView *v = containerView.subviews[idx];
photo.sourceFrame = [v convertRect:v.bounds toView:window];
[photoArrs addObject:photo];
}];
GKPhotoBrowser *browser = [GKPhotoBrowser photoBrowserWithPhotos:photoArrs currentIndex:index];
browser.showStyle = GKPhotoBrowserShowStyleZoom;
browser.hideStyle = GKPhotoBrowserHideStyleZoomScale;
browser.isLowGifMemory = YES;
[browser showFromVC:weakSelf];
GKPhotoBrowserShowStyleZoom这个方式,我发现每次show的时候.photo.imageView的frame都是从CGRectZero开始的,但是打印却是我们想要的结果,是sourceFrame,我用慢放验证了,确实是从最小开始变大的,而不是sourceImageView的位置和大小,请教是什么问题呢?
另外,建议增加一行代码:
photoView.imageView.contentMode = photo.sourceImageView.contentMode;
这样在隐藏的最后一刻不会因为原图设置的Fill的模式造成闪动,影响效果
我这边用UICollectionViewCell设置了sourceImageView, 大图浏览滚动到下一个item,手势拖回消失的时候缩放动画还是指向第一个item
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.