#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *image;
@property (strong, nonatomic) UIButton *cover;
@property (strong, nonatomic) UIImageView *imageView;
@end
@implementation ViewController
-(UIButton *)cover{
if(!_cover){
_cover = [[UIButton alloc]initWithFrame:self.view.bounds];
_cover.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5];
[self.view addSubview:_cover];
[_cover addSubview:self.imageView];
[_cover addTarget:self action:@selector(hide) forControlEvents:UIControlEventTouchUpInside];
}
return _cover;
}
-(UIImageView *)imageView
{
if (!_imageView) {
_imageView = [[UIImageView alloc]initWithFrame:_image.bounds];
_imageView.image = [UIImage imageNamed:@"movie_jf"];
}
return _imageView;
}
- (IBAction)bigimage:(UIButton *)image
{
self.image.hidden = YES;
self.imageView.center = self.image.center;
self.cover.hidden = NO;
[UIView animateWithDuration:1.0 animations:^{
self.imageView.transform= CGAffineTransformMakeScale(1.5,1.5);
}];
}
-(void)hide
{
[UIView animateWithDuration:0 animations:^{
self.imageView.transform= CGAffineTransformIdentity;
}];
self.image.hidden = NO;
self.cover.hidden = YES;
}
@end