// // CommonEditorCellImg.m // RedAnt ERP Mobile // // Created by Ray on 11/4/15. // Copyright © 2015 United Software Applications, Inc. All rights reserved. // #import "CommonEditorCellImg.h" #import "RAUtils.h" #import "RAConvertor.h" #import "ImageUploadViewController.h" #import "ImageViewController.h" @implementation CommonEditorCellImg - (void)awakeFromNib { [super awakeFromNib]; self.touchImageView0.delegate=self; self.touchImageView1.delegate=self; self.touchImageView2.delegate=self; self.imgs= [@[@"", @"",@""] mutableCopy]; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } -(void)TouchImageViewOnLongPress:(TouchImageView *)touchImageView { } - (void)TouchImageViewOnTouche:(TouchImageView *)touchImageView { __block int tag =(int) touchImageView.tag; UIViewController* vc=[RAUtils getViewController :touchImageView]; if(self.editable==true) { ImageUploadViewController * uploadvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"ImageUploadViewController"]; // UIImage* img =[self.buttonImg backgroundImageForState:UIControlStateNormal];; if(self.img_validate) uploadvc.img= touchImageView.image; uploadvc.returnValue = ^(NSString* url_down,NSString* url_up,UIImage* img) { self.imgs[tag] = url_up; NSString* newurl=[RAConvertor arr2string:self.imgs separator:@"," trim:false]; touchImageView.image=img; if(self.imgChanged) self.imgChanged(url_down,newurl,tag,url_up); }; [vc.navigationController pushViewController:uploadvc animated:false]; } else { if(touchImageView.image==nil) return ; ImageViewController * imagevc =[[UIStoryboard storyboardWithName:@"CommonEditor" bundle:nil] instantiateViewControllerWithIdentifier:@"ImageViewController"]; UIImage* img=touchImageView.image; if(self.img_validate) imagevc.image = img;//.imageView.image = [self.buttonImg backgroundImageForState:UIControlStateNormal]; // uploadvc.returnValue = ^(NSString* url_down,NSString* url_up,UIImage* img) // { // // [self.buttonImg setBackgroundImage:img forState:UIControlStateNormal]; // // if(self.imgChanged) // self.imgChanged(url_down,url_up); // // }; [vc.navigationController pushViewController:imagevc animated:false]; } // bundleVC.content_data = self.bundle_item; } @end