// // headImgScannerController.m // ThePaperHD // // Created by scar1900 on 15/3/26. // Copyright (c) 2015年 scar1900. All rights reserved. // #import "headImgScannerController.h" #import "AsyncImageView.h" @interface headImgScannerController () @end @implementation headImgScannerController @synthesize imageUrl = _imageUrl; @synthesize delegate; - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.view.backgroundColor = [UIColor blackColor]; [self.view addSubview:self.imageView]; } - (void)setImageUrl:(NSString *)url { _imageUrl = url; self.imageView.imageUrl = url; } - (AsyncImageView*)imageView { if (!_imageView) { _imageView = [[AsyncImageView alloc]initWithFrame:CGRectZero]; _imageView.isHaveWaterPrint = NO; _imageView.delegate = self; } return _imageView; } - (void)getImageSuccess:(UIImage *)image { CGSize imgSize = image.size; if (imgSize.width > 200) { CGFloat width = imgSize.width; CGFloat height = imgSize.height; height = height*200/width; imgSize = CGSizeMake(200, height); } if ([self.delegate respondsToSelector:@selector(loadImageSuccess:)]) { [self.delegate loadImageSuccess:imgSize]; } self.view.frame = CGRectMake(0, 0, imgSize.width, imgSize.height); self.imageView.frame = self.view.bounds; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end