CommonEditorCellImg.m 3.0 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.touchImageView0.tag = 0;
  18. self.touchImageView1.delegate=self;
  19. self.touchImageView1.tag =1;
  20. self.touchImageView2.delegate=self;
  21. self.touchImageView2.tag = 2;
  22. self.imgs= [@[@"", @"",@""] mutableCopy];
  23. }
  24. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  25. [super setSelected:selected animated:animated];
  26. // Configure the view for the selected state
  27. }
  28. -(void)TouchImageViewOnLongPress:(TouchImageView *)touchImageView
  29. {
  30. }
  31. - (void)TouchImageViewOnTouche:(TouchImageView *)touchImageView
  32. {
  33. __block int tag =(int) touchImageView.tag;
  34. UIViewController* vc=[RAUtils getViewController :touchImageView];
  35. if(self.editable==true)
  36. {
  37. ImageUploadViewController * uploadvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"ImageUploadViewController"];
  38. // UIImage* img =[self.buttonImg backgroundImageForState:UIControlStateNormal];;
  39. if(self.img_validate)
  40. uploadvc.img= touchImageView.image;
  41. uploadvc.returnValue = ^(NSString* url_down,NSString* url_up,UIImage* img)
  42. {
  43. self.imgs[tag] = url_up;
  44. NSString* newurl=[RAConvertor arr2string:self.imgs separator:@"," trim:false];
  45. touchImageView.image=img;
  46. if(self.imgChanged)
  47. self.imgChanged(url_down,newurl,tag,url_up);
  48. };
  49. [vc.navigationController pushViewController:uploadvc animated:false];
  50. }
  51. else
  52. {
  53. if(touchImageView.image==nil)
  54. return ;
  55. ImageViewController * imagevc =[[UIStoryboard storyboardWithName:@"CommonEditor" bundle:nil] instantiateViewControllerWithIdentifier:@"ImageViewController"];
  56. UIImage* img=touchImageView.image;
  57. if(self.img_validate)
  58. imagevc.image = img;//.imageView.image = [self.buttonImg backgroundImageForState:UIControlStateNormal];
  59. // uploadvc.returnValue = ^(NSString* url_down,NSString* url_up,UIImage* img)
  60. // {
  61. //
  62. // [self.buttonImg setBackgroundImage:img forState:UIControlStateNormal];
  63. //
  64. // if(self.imgChanged)
  65. // self.imgChanged(url_down,url_up);
  66. //
  67. // };
  68. [vc.navigationController pushViewController:imagevc animated:false];
  69. }
  70. // bundleVC.content_data = self.bundle_item;
  71. }
  72. @end