IOS Browse Photos Nqximagebrowswe

Source: Internet
Author: User

@interface Nqximagebrowswe:uitableview

/**

* @brief View Profile

*

* @param oldimageview Avatar's 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 Browse Photos Nqximagebrowswe

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.