diff --git a/SDPhotoBrowser.xcodeproj/project.xcworkspace/xcuserdata/aaron.xcuserdatad/UserInterfaceState.xcuserstate b/SDPhotoBrowser.xcodeproj/project.xcworkspace/xcuserdata/aaron.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..9c5e190 Binary files /dev/null and b/SDPhotoBrowser.xcodeproj/project.xcworkspace/xcuserdata/aaron.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/SDPhotoBrowser.xcodeproj/xcuserdata/aaron.xcuserdatad/xcschemes/SDPhotoBrowser.xcscheme b/SDPhotoBrowser.xcodeproj/xcuserdata/aaron.xcuserdatad/xcschemes/SDPhotoBrowser.xcscheme new file mode 100644 index 0000000..157f3cb --- /dev/null +++ b/SDPhotoBrowser.xcodeproj/xcuserdata/aaron.xcuserdatad/xcschemes/SDPhotoBrowser.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SDPhotoBrowser.xcodeproj/xcuserdata/aaron.xcuserdatad/xcschemes/xcschememanagement.plist b/SDPhotoBrowser.xcodeproj/xcuserdata/aaron.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..31b4b30 --- /dev/null +++ b/SDPhotoBrowser.xcodeproj/xcuserdata/aaron.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + SDPhotoBrowser.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 9973FAAD1A824A1E0089A512 + + primary + + + 9973FACE1A824A1F0089A512 + + primary + + + + + diff --git a/SDPhotoBrowser/SDPhotoBrowser/SDBrowserImageView.m b/SDPhotoBrowser/SDPhotoBrowser/SDBrowserImageView.m index 03d6567..9c57c48 100755 --- a/SDPhotoBrowser/SDPhotoBrowser/SDBrowserImageView.m +++ b/SDPhotoBrowser/SDPhotoBrowser/SDBrowserImageView.m @@ -192,12 +192,14 @@ - (void)prepareForImageViewScaling UIImageView *zoomingImageView = [[UIImageView alloc] initWithImage:self.image]; CGSize imageSize = zoomingImageView.image.size; CGFloat imageViewH = self.bounds.size.height; + CGFloat imageViewW = self.bounds.size.width; //1. 获取图片宽度 if (imageSize.width > 0) { imageViewH = self.bounds.size.width * (imageSize.height / imageSize.width); + imageViewW = imageViewH / imageSize.height * imageSize.width; } - zoomingImageView.bounds = CGRectMake(0, 0, self.bounds.size.width, imageViewH); + zoomingImageView.bounds = CGRectMake(0, 0, imageViewW, imageViewH); //2. 设置图片的宽度,而不是显示在 imageView 中. zoomingImageView.center = _zoomingScroolView.center; - zoomingImageView.contentMode = UIViewContentModeScaleAspectFit; + zoomingImageView.contentMode = UIViewContentModeScaleToFill; //3. 修复缩放后会比例失调的问题 _zoomingImageView = zoomingImageView; [_zoomingScroolView addSubview:zoomingImageView]; [self addSubview:_zoomingScroolView];