Skip to content
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

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

Open
Yohann-Chen opened this issue Mar 29, 2017 · 0 comments
Open

Comments

@Yohann-Chen
Copy link

在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大大看看这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant