Commit 0a4ee696 authored by yuzheng.tz's avatar yuzheng.tz

优化全景图片的选择体验,增加清晰度和最大可放大比例

parent 570eedc8
...@@ -417,7 +417,11 @@ static CGFloat TZScreenScale; ...@@ -417,7 +417,11 @@ static CGFloat TZScreenScale;
} else { } else {
PHAsset *phAsset = (PHAsset *)asset; PHAsset *phAsset = (PHAsset *)asset;
CGFloat aspectRatio = phAsset.pixelWidth / (CGFloat)phAsset.pixelHeight; CGFloat aspectRatio = phAsset.pixelWidth / (CGFloat)phAsset.pixelHeight;
CGFloat pixelWidth = photoWidth * TZScreenScale; CGFloat pixelWidth = photoWidth * TZScreenScale * 1.5;
// 优化超宽图片的显示
if (aspectRatio > 1) {
pixelWidth = pixelWidth * aspectRatio;
}
CGFloat pixelHeight = pixelWidth / aspectRatio; CGFloat pixelHeight = pixelWidth / aspectRatio;
imageSize = CGSizeMake(pixelWidth, pixelHeight); imageSize = CGSizeMake(pixelWidth, pixelHeight);
} }
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
_scrollView.delegate = self; _scrollView.delegate = self;
_scrollView.scrollsToTop = NO; _scrollView.scrollsToTop = NO;
_scrollView.showsHorizontalScrollIndicator = NO; _scrollView.showsHorizontalScrollIndicator = NO;
_scrollView.showsVerticalScrollIndicator = NO; _scrollView.showsVerticalScrollIndicator = YES;
_scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_scrollView.delaysContentTouches = NO; _scrollView.delaysContentTouches = NO;
_scrollView.canCancelContentTouches = YES; _scrollView.canCancelContentTouches = YES;
...@@ -197,6 +197,15 @@ ...@@ -197,6 +197,15 @@
- (void)setAllowCrop:(BOOL)allowCrop { - (void)setAllowCrop:(BOOL)allowCrop {
_allowCrop = allowCrop; _allowCrop = allowCrop;
_scrollView.maximumZoomScale = allowCrop ? 4.0 : 2.5; _scrollView.maximumZoomScale = allowCrop ? 4.0 : 2.5;
if ([self.asset isKindOfClass:[PHAsset class]]) {
PHAsset *phAsset = (PHAsset *)self.asset;
CGFloat aspectRatio = phAsset.pixelWidth / (CGFloat)phAsset.pixelHeight;
// 优化超宽图片的显示
if (aspectRatio > 1.5) {
self.scrollView.maximumZoomScale *= aspectRatio / 1.5;
}
}
} }
- (void)refreshScrollViewContentSize { - (void)refreshScrollViewContentSize {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment