Git Product home page Git Product logo

sdphotobrowser's People

Contributors

gsdios avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdphotobrowser's Issues

feature

加个双击图片放大就更赞了

cocopod支持相关

你好,请问项目可以支持cocospod吗,这样使用者会方便,会有更多的人使用

设置contentMode 时 缩放图片的动画最后会闪烁一下

我在你的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];
}];

现拍的照片,点击放大后,缩放会变形

现拍的照片,点击放大后,缩放会变形。- (void)zoomWithScale:(CGFloat)scale在这个方法里,
_zoomingImageView.transform = CGAffineTransformScale(CGAffineTransformIdentity, scale, scale);
_zoomingImageView.backgroundColor = [UIColor blackColor];//后添加的
就好使了,请问这是怎么回事。

大图打开之后比例不对

先加载缩略图,然后下载大图后切换到大图显示,这个时候显示的大图比例不对,要拉伸一下才会正常比例

imageview的image加载失败,点击这个imageView会导致崩溃

在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崩溃

Demo中点击 <保存> 按钮, 会奔溃

你好,最近再用你的控件,非常好用。有几点小建议

1.如果photos是collectionView的情况下,在collectionView复用、或者collectionView用删除添加操作的话,通过subViews去取sourceView的时候,是存在问题的。
建议可以添加一个代理方法:专门返回当前点击的子View,我改了一下,测试了几台机器,还是很好用的。请楼主采纳
添加的代理方法:

  • (UIView *)photoBrowserGetCurrentViewWithIndex:(NSInteger)index;
    获取当前子View代理方法:
    UIView *sourceView = self.sourceImagesContainerView.subviews[self.currentImageIndex];
    if ([self.delegate respondsToSelector:@selector(photoBrowserGetCurrentViewWithIndex:)]){
    sourceView = [self.delegate photoBrowserGetCurrentViewWithIndex:self.currentImageIndex];
    }
    代理实现
  • (UIView *)photoBrowserGetCurrentViewWithIndex:(NSInteger)index {
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:index inSection:0];
    WSTeamFeedCollecionCell *cell = (WSTeamFeedCollecionCell *)[self.productImageView cellForItemAtIndexPath:indexPath];
    return cell;
    }

3DTouch查看照片

请问能否添加3DTouch查看图片的功能 , 因为本人现在用的是这个框架 本人曾尝试这个效果, 但是因为3DTouch的代理在你重压下弹出来的 必须是 控制器 所以重压图片的时候 并无法弹出预览图片的控制器 因为它是一个view

图片放大

图片放大之后,位置跑的太偏了,希望可以优化下。

你好,使用时候会出现数组越界情况

你好,使用框架时候,例如我有6张图片,点击进去一直拖动,拖动到第6张的时候,会出现数组越界的情况,导致程序cash,请问这个容错处理是该怎么解决的.

点击图片crash

  • (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 小于 图片数组的时候

感觉此处这样做判断不是很好,很容易引起crash

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];
}

显示图片是压缩的问题

  • (void)setPhotoItemArray:(NSArray *)photoItemArray
    这个方法中 如果设置 btn.imageView.contentMode = UIViewContentModeScaleAspectFill; 按钮显示的图片模式是等比例的伸缩 这样 点击浏览的图片 消失的时候 CGRect targetTemp = [self.sourceImagesContainerView convertRect:sourceView.frame toView:self]; 效果是 图片位置有晃一下的效果 原因是 targetTemp的尺寸和 默认的尺寸不一致 就会有个位置错乱的动画

图片放大问题

1、放大后移动图片 , 再金星缩放时图片瞬移到中间
2、放大比例比较大的时候,不是放大的中心点不对

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.