iOS 浏览照片NQXImageBrowswe

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS 浏览照片NQXImageBrowswe相关的知识,希望对你有一定的参考价值。

@interface NQXImageBrowswe : UITableView

/**

 *  @brief  浏览头像

 *

 *  @param  oldImageView    头像所在的imageView

 */

+(void)showImage:(UIImageView*)avatarImageView;

@end

 

 

 

 

#import "NQXImageBrowswe.h"

static CGRect oldframe;

 

@implementation NQXImageBrowswe

+(void)showImage:(UIImageView *)avatarImageView{

    UIImage *image=avatarImageView.image;

    UIWindow *window=[UIApplication sharedApplication].keyWindow;

    UIView *backgroundView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];

    oldframe=[avatarImageView convertRect:avatarImageView.bounds toView:window];

    backgroundView.backgroundColor=[UIColor blackColor];

    backgroundView.alpha=0;

    UIImageView *imageView=[[UIImageView alloc]initWithFrame:oldframe];

    imageView.image=image;

    imageView.tag=1;

    [backgroundView addSubview:imageView];

    [window addSubview:backgroundView];

    

    UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hideImage:)];

    [backgroundView addGestureRecognizer: tap];

    

    [UIView animateWithDuration:0.3 animations:^{

        imageView.frame=CGRectMake(0,([UIScreen mainScreen].bounds.size.height-image.size.height*[UIScreen mainScreen].bounds.size.width/image.size.width)/2, [UIScreen mainScreen].bounds.size.width, image.size.height*[UIScreen mainScreen].bounds.size.width/image.size.width);

        backgroundView.alpha=1;

    } completion:^(BOOL finished) {

        

    }];

}

 

+(void)hideImage:(UITapGestureRecognizer*)tap{

    UIView *backgroundView=tap.view;

    UIImageView *imageView=(UIImageView*)[tap.view viewWithTag:1];

    [UIView animateWithDuration:0.3 animations:^{

        imageView.frame=oldframe;

        backgroundView.alpha=0;

    } completion:^(BOOL finished) {

        [backgroundView removeFromSuperview];

    }];

}

 

 

@end

 

以上是关于iOS 浏览照片NQXImageBrowswe的主要内容,如果未能解决你的问题,请参考以下文章

求问怎么把照片裁剪成证件照?希望可以批量处理的。

使用证件照研究院的水印file_name获取无水印照片

怎么样照全景?

如何用美图秀秀更改照片背景颜色

5寸,7寸,10寸照片的大小

Java如何实现证件照换底色| 背景换色