1.通过上下文获取当前图片
2.动态添加一个UIImageView
3.计算目标位置的frame 做属性动画
4.动画完毕移除imageVIew,创建对应的图片查看器(未实现)
UIGraphicsBeginImageContextWithOptions(self.imageView.bounds.size, YES, 0);
[self.imageView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIImageView * coverView = [[UIImageView alloc] initWithImage:image];
coverView.frame = self.imageView.frame;
[self.view addSubview:coverView];
CGFloat w = [UIScreen mainScreen].bounds.size.width;
CGFloat h = w / coverView.bounds.size.width * coverView.bounds.size.height;
[UIView animateWithDuration:4 animations:^{
coverView.frame = CGRectMake(([UIScreen mainScreen].bounds.size.width - w) * 0.5, ([UIScreen mainScreen].bounds.size.height - h) * 0.5, w, h);
} completion:^(BOOL finished) {
[coverView removeFromSuperview];
}];
网友评论