CommonEditorCellImg.m 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 "ImageUploadViewController.h"
  11. #import "ImageViewController.h"
  12. @implementation CommonEditorCellImg
  13. - (void)awakeFromNib {
  14. // Initialization code
  15. }
  16. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  17. [super setSelected:selected animated:animated];
  18. // Configure the view for the selected state
  19. }
  20. - (IBAction)ImgButtonClicked:(UIButton *)sender {
  21. UIViewController* vc=[RAUtils getViewController :sender];
  22. if(self.editable==true)
  23. {
  24. ImageUploadViewController * uploadvc =[ vc.storyboard instantiateViewControllerWithIdentifier:@"ImageUploadViewController"];
  25. // UIImage* img =[self.buttonImg backgroundImageForState:UIControlStateNormal];;
  26. if(self.img_validate)
  27. uploadvc.img= [self.buttonImg backgroundImageForState:UIControlStateNormal];
  28. uploadvc.returnValue = ^(NSString* url_down,NSString* url_up,UIImage* img)
  29. {
  30. [self.buttonImg setBackgroundImage:img forState:UIControlStateNormal];
  31. if(self.imgChanged)
  32. self.imgChanged(url_down,url_up);
  33. };
  34. [vc.navigationController pushViewController:uploadvc animated:false];
  35. }
  36. else
  37. {
  38. ImageViewController * imagevc =[ vc.storyboard instantiateViewControllerWithIdentifier:@"ImageViewController"];
  39. UIImage* img=[self.buttonImg backgroundImageForState:UIControlStateNormal];
  40. if(self.img_validate)
  41. imagevc.image = img;//.imageView.image = [self.buttonImg backgroundImageForState:UIControlStateNormal];
  42. // uploadvc.returnValue = ^(NSString* url_down,NSString* url_up,UIImage* img)
  43. // {
  44. //
  45. // [self.buttonImg setBackgroundImage:img forState:UIControlStateNormal];
  46. //
  47. // if(self.imgChanged)
  48. // self.imgChanged(url_down,url_up);
  49. //
  50. // };
  51. [vc.navigationController pushViewController:imagevc animated:false];
  52. }
  53. // bundleVC.content_data = self.bundle_item;
  54. }
  55. //
  56. //
  57. //-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  58. //{
  59. // if(self.editable==true)
  60. // return;
  61. // self.isFullScreen = !self.isFullScreen;
  62. // UITouch *touch = [touches anyObject];
  63. //
  64. // CGPoint touchPoint = [touch locationInView:self.contentView];
  65. //
  66. // CGPoint imagePoint = self.imageView.frame.origin;
  67. // //touchPoint.x ,touchPoint.y 就是触点的坐标
  68. //
  69. // // 触点在imageView内,点击imageView时 放大,再次点击时缩小
  70. // if(imagePoint.x <= touchPoint.x && imagePoint.x +self.imageView.frame.size.width >=touchPoint.x && imagePoint.y <= touchPoint.y && imagePoint.y+self.imageView.frame.size.height >= touchPoint.y)
  71. // {
  72. // // 设置图片放大动画
  73. // [UIView beginAnimations:nil context:nil];
  74. // // 动画时间
  75. // [UIView setAnimationDuration:1];
  76. //
  77. // if (self.isFullScreen) {
  78. // // 放大尺寸
  79. //
  80. // self.buttonImg.frame = CGRectMake(0, 0, 768, 1024);
  81. // }
  82. // else {
  83. // // 缩小尺寸
  84. // self.buttonImg.frame = CGRectMake(50, 65, 100, 100);
  85. // }
  86. //
  87. // // commit动画
  88. // [UIView commitAnimations];
  89. //
  90. // }
  91. //
  92. //}
  93. @end