CommonEditorCellImg.m 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //
  2. // CommonEditorCellImg.m
  3. // RedAnt ERP Mobile
  4. //
  5. // Created by Ray on 11/4/15.
  6. // Copyright © 2015 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "CommonEditorCellImg.h"
  9. #import "RAUtils.h"
  10. #import "RAConvertor.h"
  11. #import "ImageUploadViewController.h"
  12. #import "ImageViewController.h"
  13. @implementation CommonEditorCellImg
  14. - (void)awakeFromNib {
  15. [super awakeFromNib];
  16. self.touchImageView0.delegate=self;
  17. self.touchImageView1.delegate=self;
  18. self.touchImageView2.delegate=self;
  19. self.imgs= [@[@"", @"",@""] mutableCopy];
  20. }
  21. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  22. [super setSelected:selected animated:animated];
  23. // Configure the view for the selected state
  24. }
  25. -(void)TouchImageViewOnLongPress:(TouchImageView *)touchImageView
  26. {
  27. }
  28. - (void)TouchImageViewOnTouche:(TouchImageView *)touchImageView
  29. {
  30. __block int tag =(int) touchImageView.tag;
  31. UIViewController* vc=[RAUtils getViewController :touchImageView];
  32. if(self.editable==true)
  33. {
  34. ImageUploadViewController * uploadvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"ImageUploadViewController"];
  35. // UIImage* img =[self.buttonImg backgroundImageForState:UIControlStateNormal];;
  36. if(self.img_validate)
  37. uploadvc.img= touchImageView.image;
  38. uploadvc.returnValue = ^(NSString* url_down,NSString* url_up,UIImage* img)
  39. {
  40. self.imgs[tag] = url_up;
  41. NSString* newurl=[RAConvertor arr2string:self.imgs separator:@"," trim:false];
  42. touchImageView.image=img;
  43. if(self.imgChanged)
  44. self.imgChanged(url_down,newurl,tag,url_up);
  45. };
  46. [vc.navigationController pushViewController:uploadvc animated:false];
  47. }
  48. else
  49. {
  50. if(touchImageView.image==nil)
  51. return ;
  52. ImageViewController * imagevc =[[UIStoryboard storyboardWithName:@"CommonEditor" bundle:nil] instantiateViewControllerWithIdentifier:@"ImageViewController"];
  53. UIImage* img=touchImageView.image;
  54. if(self.img_validate)
  55. imagevc.image = img;//.imageView.image = [self.buttonImg backgroundImageForState:UIControlStateNormal];
  56. // uploadvc.returnValue = ^(NSString* url_down,NSString* url_up,UIImage* img)
  57. // {
  58. //
  59. // [self.buttonImg setBackgroundImage:img forState:UIControlStateNormal];
  60. //
  61. // if(self.imgChanged)
  62. // self.imgChanged(url_down,url_up);
  63. //
  64. // };
  65. [vc.navigationController pushViewController:imagevc animated:false];
  66. }
  67. // bundleVC.content_data = self.bundle_item;
  68. }
  69. @end