gsdios / sdphotobrowser Goto Github PK
View Code? Open in Web Editor NEWA image browser which is easy for using.
A image browser which is easy for using.
由于didMoveToSuperview的回调函数会在每次属性superview改变时回调。从而造成,移除了还初始化出了scrollView导致一些内存浪费
1.修复图片滑动崩溃
2.修复图片索引问题
已 pr
Cannot remove an observer <SDPhotoBrowser 0x101369e40> for the key path "frame" from <UIWindow 0x10130df50> because it is not registered as an observer.
加个双击图片放大就更赞了
图片缩小后不能,不能上下滑动。一般的图片还没问题,长图的话就不好了
demo 里面的collectionView 点击小图放大后 双击再放大 再滑动 还没到边缘就缩回去了
1.我模仿你的微信写的cell,里面用的SDPhotoBrowser,里面的图片是不是没有适配屏幕啊,三张的话,第三张也不在第一排,直接跑到第二排去了。
你好,请问项目可以支持cocospod吗,这样使用者会方便,会有更多的人使用
我在你的Demo里设置了 contentMode 40行 动画最后会闪一下才变回原来的frame
请问有什么好的解决方案。
[photoItemArray enumerateObjectsUsingBlock:^(SDPhotoItem *obj, NSUInteger idx, BOOL *stop) {
UIButton *btn = [[UIButton alloc] init];
[btn sd_setImageWithURL:[NSURL URLWithString:obj.thumbnail_pic] forState:UIControlStateNormal];
btn.imageView.contentMode = UIViewContentModeScaleAspectFill;
btn.tag = idx;
[btn addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:btn];
}];
点击图片之后出现 图片缩的很小并飞向左上方 当页面出栈 然后再次push进去之后还是如此 并且如果有其他类似的弹出的页面 也会隐约出现放大后的图片 查看层级视图Xcode直接崩溃
现拍的照片,点击放大后,缩放会变形。- (void)zoomWithScale:(CGFloat)scale在这个方法里,
_zoomingImageView.transform = CGAffineTransformScale(CGAffineTransformIdentity, scale, scale);
_zoomingImageView.backgroundColor = [UIColor blackColor];//后添加的
就好使了,请问这是怎么回事。
先加载缩略图,然后下载大图后切换到大图显示,这个时候显示的大图比例不对,要拉伸一下才会正常比例
保存按钮保存完成时大菊花偶尔没有隐藏,stopAnimating搞定。
[_indicatorView stopAnimating];
大家下载下,如果有其他问题再反馈下,我会及时调整修复的。
https://github.com/chennyhuang/HZPhotoBrowser 这个跟你的好像,
然后浏览多张高清大图时,内存爆增,离开画页,销毁画页还是没有降下来
博主你好。当返回大图片的等时候,单击图片无响应。消失不了。不知道什么原因。
在大图加载完毕后,再变大显示到大图
用手机照的图片放大会变形,变成长条形
在SDPhotoBrowser.m的 photoClick方法 第195行中
您是这样写的
`CGFloat h = (self.bounds.size.width / currentImageView.image.size.width) * currentImageView.image.size.height;
if (!currentImageView.image) { // 防止 因imageview的image加载失败 导致 崩溃
h = self.bounds.size.height;
}
//原来是h
tempView.bounds = CGRectMake(0, 0, self.bounds.size.width, h);`
但实际上,currentImageView.image已经被初始化过了,但是因为没有图,所以取currentImageView.image.size.width是取不到值得,所以h的值就是NaN,然后后面又使用了h,导致了崩溃。
if (currentImageView.image.size.width == 0) { // 防止 因imageview的image加载失败 导致 崩溃 h = self.bounds.size.height; }
如果把判断改成用image的宽度或者高度判断 就可以解决这个问题。
希望GSD大大看看这个问题
Demo中点击 <保存> 按钮, 会奔溃
1.如果photos是collectionView的情况下,在collectionView复用、或者collectionView用删除添加操作的话,通过subViews去取sourceView的时候,是存在问题的。
建议可以添加一个代理方法:专门返回当前点击的子View,我改了一下,测试了几台机器,还是很好用的。请楼主采纳
添加的代理方法:
点击图片 放大 的过程不够流畅 ,放大后 再点击 会回到当前图片的位置 这个过程也不是很流畅 有点卡顿延迟的感觉.过程好像有闪烁
我用webview打开页面,当点击图片是显示图片,已经获取了所有图片的链接,请问如何处理
错误方法在这 ...好像不好改的样子
如题~
请问能否添加3DTouch查看图片的功能 , 因为本人现在用的是这个框架 本人曾尝试这个效果, 但是因为3DTouch的代理在你重压下弹出来的 必须是 控制器 所以重压图片的时候 并无法弹出预览图片的控制器 因为它是一个view
SDPhotoBrowser.m
文件的- (void)photoClick:(UITapGestureRecognizer *)recognizer
方法里面的这句UIView *sourceView = self.sourceImagesContainerView.subviews[currentIndex];
数据越界,各位有好的方案吗?
图片放大之后,位置跑的太偏了,希望可以优化下。
刚下载你的demo目前无法正常查看效果,作者请悉知。
你好,使用框架时候,例如我有6张图片,点击进去一直拖动,拖动到第6张的时候,会出现数组越界的情况,导致程序cash,请问这个容错处理是该怎么解决的.
(void)photoClick:(UITapGestureRecognizer *)recognizer
{
_scrollView.hidden = YES;
_willDisappear = YES;
SDBrowserImageView *currentImageView = (SDBrowserImageView *)recognizer.view;
NSInteger currentIndex = currentImageView.tag;
UIView *sourceView = self.sourceImagesContainerView.subviews[currentIndex];
CGRect targetTemp = [self.sourceImagesContainerView convertRect:sourceView.frame toView:self];
UIImageView *tempView = [[UIImageView alloc] init];
tempView.contentMode = sourceView.contentMode;
tempView.clipsToBounds = YES;
tempView.image = currentImageView.image;
CGFloat h = (self.bounds.size.width / currentImageView.image.size.width) * currentImageView.image.size.height;
if (!currentImageView.image) { // 防止 因imageview的image加载失败 导致 崩溃
h = self.bounds.size.height;
}
tempView.bounds = CGRectMake(0, 0, self.bounds.size.width, h);
tempView.center = self.center;
[self addSubview:tempView];
_saveButton.hidden = YES;
[UIView animateWithDuration:SDPhotoBrowserHideImageAnimationDuration animations:^{
tempView.frame = targetTemp;
self.backgroundColor = [UIColor clearColor];
_indexLabel.alpha = 0.1;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
这里会导致crash
UIView *sourceView = self.sourceImagesContainerView.subviews[currentIndex];
场景:
sourceImagesContainerView的subviews的count 小于 图片数组的时候
如题,希望能修复一下
没做图放大?
self.frame = window.bounds; bounds为零的问题 self.frame = [UIScreen mainScreen].bounds;代替会出现单击图片之后会出现试图穿透情况,下个层级的视图会收到touch
如题,在ios7上横屏显示有问题,没有适配啊
UIView *sourceView = nil;
if ([self.sourceImagesContainerView isKindOfClass:UICollectionView.class]) {
UICollectionView *view = (UICollectionView *)self.sourceImagesContainerView;
NSIndexPath *path = [NSIndexPath indexPathForItem:currentIndex inSection:0];
sourceView = [view cellForItemAtIndexPath:path];
}else {
sourceView = self.sourceImagesContainerView.subviews[currentIndex];
}
使用这个播放 gif 动画 4个2m 的 就300m 得内存了 怎么优化?
1、放大后移动图片 , 再金星缩放时图片瞬移到中间
2、放大比例比较大的时候,不是放大的中心点不对
使用背景:父视图是UIView+3个imageView,点击放大后,滑动到第二张背景图就丢失了
[window addObserver:self forKeyPath:@"frame" options:0 context:nil];
运行了几次,发现也没有调用到监听方法里去
设置 imageView的 contentMode 为 UIViewContentModeScaleAspectFill,返回时会闪一下,请问怎么解决
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.