单击图片放大,浏览图片细节,之后再单击回到原始页面,
如果在浏览细节时候,双击图片 会局部放大,也可以双手拖拽放大,
newImage.gif
代码参考
#import "TransImageTool.h"
#define kSCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define kSCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
#define kMaxZoom 3
@interface TransImageTool ()
@property (nonatomic, assign) CGFloat width;
@property (nonatomic, assign) CGFloat height;
@property (nonatomic, assign) BOOL isTwiceTaping;
@property (nonatomic, assign) BOOL isDoubleTapingForZoom;
@property (nonatomic, assign) CGFloat currentScale;
@property (nonatomic, assign) CGFloat offsetY;
@property (nonatomic, assign) CGFloat touchX;
@property (nonatomic, assign) CGFloat touchY;
@property (nonatomic, strong) UIImageView *transImageView;
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) UIView *backView;
@property (nonatomic, strong) UIButton *userBtn ;
@property (nonatomic, strong) UIView *userBtnContainer ;
@end
static CGRect oldframe;
@implementation TransImageTool
- (void)showImage:(UIImageView *)avatarImageView{
UIImage *image = avatarImageView.image;
UIWindow *window = [UIApplication sharedApplication].keyWindow;
oldframe = [avatarImageView convertRect:avatarImageView.bounds toView:window];
UIImageView *imageView = [[UIImageView alloc]initWithFrame:oldframe];
imageView.image = image;
self.transImageView = imageView;
UIScrollView *scrollView = [[UIScroll