现在的位置: 首页 > 综合 > 正文

ios小图片点击变大全屏 全屏图片点击后复原

2013年03月07日 ⁄ 综合 ⁄ 共 1008字 ⁄ 字号 评论关闭

//缩略图点击出现大图

- (void)handleGesture:(UITapGestureRecognizer *)gesture

{

   
UIImageView *imageView = [UIImageView
new];

    imageView.bounds =
self.imagView_Pic.frame;

    imageView.image =
self.imagView_Pic.image;

    CGPoint point = [gesture
locationInView:self.superview.superview.superview];

   
self.point =
CGPointMake(768-point.y, point.x);

    imageView.center =
self.point;

    imageView.transform =
CGAffineTransformMakeRotation(M_PI_2);

    imageView.userInteractionEnabled =
YES;

   
UITapGestureRecognizer *gesture1 = [[UITapGestureRecognizer
alloc] initWithTarget:self
action:@selector(handleGesture1:)];

    [imageView
addGestureRecognizer:gesture1];

    [self.window
addSubview:imageView];

    [UIView
animateWithDuration:0.5
animations:^{

        imageView.frame =
CGRectMake(0,
0, 768,
1024
);

    }];

}

//全屏图片点击后回复到缩略图

- (void)handleGesture1:(UITapGestureRecognizer *)gesture

{

   
UIView *view = gesture.view;

    [UIView
animateWithDuration:0.5
animations:^{

        view.bounds =
self.imagView_Pic.frame;

        view.center =
self.point;

    }
completion:^(BOOL finished) {

        [view removeFromSuperview];

    }];

}

抱歉!评论已关闭.