We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
(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 小于 图片数组的时候
The text was updated successfully, but these errors were encountered:
No branches or pull requests
(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 小于 图片数组的时候
The text was updated successfully, but these errors were encountered: