GoodsDetailViewController.m 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. // GoodsDetailViewController
  2. // IOBSS 2.0
  3. //
  4. // Created by on 2017.7.24
  5. // Copyright 2017 沈阳东科云信软件有限公司. All rights reserved.
  6. //
  7. // 系统名称:
  8. // 功能描述:商品详细界面
  9. #import "GoodsDetailViewController.h"
  10. #import "XHImageViewer.h"
  11. @interface GoodsDetailViewController() <XHImageViewerDelegate>{
  12. /**
  13. 图片点击手势
  14. */
  15. UITapGestureRecognizer *_singleTap;
  16. }
  17. @end
  18. @implementation GoodsDetailViewController
  19. #pragma mark - 公共函数
  20. /**
  21. viewDidLoad函数
  22. */
  23. - (void)viewDidLoad {
  24. [super viewDidLoad];
  25. self.navigationItem.title=@"商品详细";
  26. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  27. [button setBackgroundImage:[UIImage imageNamed:@"icon_back.png"]
  28. forState:UIControlStateNormal];
  29. [button addTarget:self action:@selector(goBack)
  30. forControlEvents:UIControlEventTouchUpInside];
  31. button.frame = CGRectMake(0, 0, 15, 18);
  32. UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
  33. self.navigationItem.leftBarButtonItem = menuButton;
  34. _detailArr = [[NSMutableArray alloc] init];
  35. [self initUI];
  36. [self loadData];
  37. }
  38. /**
  39. 修改:2017-9-25
  40. 适配机型
  41. 安全区视图发生变化
  42. */
  43. -(void)viewSafeAreaInsetsDidChange{
  44. _scroll.frame = self.view.safeAreaLayoutGuide.layoutFrame;
  45. [super viewSafeAreaInsetsDidChange];
  46. }
  47. /**
  48. didReceiveMemoryWarning函数
  49. */
  50. - (void)didReceiveMemoryWarning {
  51. [super didReceiveMemoryWarning];
  52. }
  53. #pragma mark - 委托函数
  54. //数据加载成功函数
  55. - (void)onLoadFinish:(ASIDownManager *)sender {
  56. NSDictionary *dic = [sender.mWebStr JSONValue];
  57. [self cancel];
  58. if (dic && [dic isKindOfClass:[NSDictionary class]]) {
  59. int iStatus = [[dic objectForKey:@"Status"] intValue];
  60. NSString *message=[dic objectForKey:@"Message"];
  61. if (iStatus == 0) {
  62. NSArray * approvArr=[dic objectForKey:@"Result"];
  63. if(approvArr!=nil&&approvArr.count>0)
  64. {
  65. _detailArr= [NSMutableArray arrayWithArray: approvArr];
  66. if( _detailArr.count == 0){
  67. [self showAlertViewText:@"未找到匹配结果"];
  68. }
  69. NSDictionary *dic=_detailArr[0];
  70. NSString *Photo = [dic objectForKey:@"Photo"];
  71. if(Photo){
  72. NSData *_decodedImageData = [[NSData alloc] initWithBase64EncodedString:Photo options:(NSDataBase64DecodingIgnoreUnknownCharacters)];
  73. UIImage *_decodedImage = [UIImage imageWithData:_decodedImageData];
  74. _imageView.image = _decodedImage;
  75. _imageView.frame =CGRectMake(10, CGRectGetMaxY(_contentView.frame)+10, 85, 85);
  76. _scroll.contentSize=CGSizeMake(self.view.frame.size.width, CGRectGetMaxY(_imageView.frame)+10);
  77. }
  78. _lblCode.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"Code"] ];
  79. _lblOnlyCode.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"OnlyCode"]];
  80. _lblBrandName.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"BrandName"]];
  81. _lblKindName.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"KindName"]];
  82. _lblVarietyName.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"VarietyName"]];
  83. _lblSeriesName.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"SeriesName"]];
  84. _lblColorNumber.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"ColorNumber"]];
  85. _lblGradeName.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"GradeName"]];
  86. _lblWarehouseName.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"WarehouseName"]];
  87. _lblPositionNumber.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"PositionNumber"]];
  88. _lblSpecification.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"Specification"]];
  89. _lblWeight.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"Weight"]];
  90. _lblAcreage.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"Acreage"]];
  91. _lblPackage.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"Package"]];
  92. _lblInventoryQuantity.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"InventoryQuantity"]];
  93. _lblOccupyQuantity.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"OccupyQuantity"]];
  94. _lblFreezeQuantity.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"FreezeQuantity"]];
  95. _lblNoDeliveryQuantity.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"NoDeliveryQuantity"]];
  96. _lblNoEnterQuantity.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"NoEnterQuantity"]];
  97. _lblBalanceQuantity.text=[NSString stringWithFormat:@"%@",[dic objectForKey:@"BalanceQuantity"]];
  98. }
  99. }
  100. else if(iStatus==ActionResultStatusAuthError
  101. ||iStatus==ActionResultStatusNoLogin
  102. ||iStatus==ActionResultStatusLogined ||iStatus == ActionResultStatusLoginedInvalid){
  103. [self showReLoginDialog:message];
  104. return;
  105. }
  106. else {
  107. [self showAlertViewText:message];
  108. }
  109. }
  110. }
  111. /**
  112. 数据加载失败函数
  113. @param sender
  114. */
  115. - (void)onLoadFail:(ASIDownManager *)sender {
  116. [self cancel];
  117. [self showAlertViewText:@"加载失败"];
  118. }
  119. #pragma mark - 私有函数
  120. /**
  121. 返回函数
  122. */
  123. - (void)goBack{
  124. [self.navigationController popViewControllerAnimated:YES];
  125. }
  126. /**
  127. 初始化UI
  128. */
  129. - (void)initUI{
  130. _scroll = [UIScrollView new];
  131. _scroll.frame = CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT - rectNavHeight - rectStatusHeight);
  132. [self.view addSubview:_scroll];
  133. _contentView = [[UIView alloc]init];
  134. _contentView.layer.cornerRadius = CornerRadius;
  135. _contentView.backgroundColor = [UIColor whiteColor];
  136. CGFloat xpadding = 5;
  137. CGFloat ypadding = 10;
  138. _contentView.frame = CGRectZero;
  139. [_scroll addSubview:_contentView];
  140. UILabel *lblTitleCode = [[UILabel alloc]init];
  141. lblTitleCode.frame = CGRectMake(xpadding,10,80,25);
  142. lblTitleCode.text=@"商品编码:";
  143. lblTitleCode.font=orderTextFont;
  144. [_contentView addSubview:lblTitleCode];
  145. _lblCode = [[UILabel alloc]init];
  146. _lblCode.frame=CGRectMake(CGRectGetMaxX(lblTitleCode.frame),10,250, 25);
  147. _lblCode.font=orderTextFont;
  148. [_contentView addSubview:_lblCode];
  149. UILabel *lblTitleOnlyCode = [[UILabel alloc]init];
  150. lblTitleOnlyCode.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleCode.frame)+ypadding,80,25);
  151. lblTitleOnlyCode.text=@"唯一编码:";
  152. lblTitleOnlyCode.font=orderTextFont;
  153. [_contentView addSubview:lblTitleOnlyCode];
  154. _lblOnlyCode = [[UILabel alloc]init];
  155. _lblOnlyCode.frame=CGRectMake(CGRectGetMaxX(lblTitleOnlyCode.frame),CGRectGetMaxY(lblTitleCode.frame)+ypadding,250, 25);
  156. _lblOnlyCode.font=orderTextFont;
  157. [_contentView addSubview:_lblOnlyCode];
  158. UILabel *lblTitleBrand = [[UILabel alloc]init];
  159. lblTitleBrand.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleOnlyCode.frame)+ypadding,80,25);
  160. lblTitleBrand.text=@"品 牌:";
  161. lblTitleBrand.font=orderTextFont;
  162. [_contentView addSubview:lblTitleBrand];
  163. _lblBrandName = [[UILabel alloc]init];
  164. _lblBrandName.frame=CGRectMake(CGRectGetMaxX(lblTitleBrand.frame),CGRectGetMaxY(lblTitleOnlyCode.frame)+ypadding,250, 25);
  165. _lblBrandName.font=orderTextFont;
  166. [_contentView addSubview:_lblBrandName];
  167. UILabel *lblTitleKind = [[UILabel alloc]init];
  168. lblTitleKind.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleBrand.frame)+ypadding,80,25);
  169. lblTitleKind.text=@"种 类:";
  170. lblTitleKind.font=orderTextFont;
  171. [_contentView addSubview:lblTitleKind];
  172. _lblKindName = [[UILabel alloc]init];
  173. _lblKindName.frame=CGRectMake(CGRectGetMaxX(lblTitleKind.frame),CGRectGetMaxY(lblTitleBrand.frame)+ypadding,250, 25);
  174. _lblKindName.font=orderTextFont;
  175. [_contentView addSubview:_lblKindName];
  176. UILabel *lblTitleVariety = [[UILabel alloc]init];
  177. lblTitleVariety.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleKind.frame)+ypadding,80,25);
  178. lblTitleVariety.text=@"品 种:";
  179. lblTitleVariety.font=orderTextFont;
  180. [_contentView addSubview:lblTitleVariety];
  181. _lblVarietyName = [[UILabel alloc]init];
  182. _lblVarietyName.frame=CGRectMake(CGRectGetMaxX(lblTitleVariety.frame),CGRectGetMaxY(lblTitleKind.frame)+ypadding,250, 25);
  183. _lblVarietyName.font=orderTextFont;
  184. [_contentView addSubview:_lblVarietyName];
  185. UILabel *lblTitleSeries = [[UILabel alloc]init];
  186. lblTitleSeries.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleVariety.frame)+ypadding,80,25);
  187. lblTitleSeries.text=@"系 列:";
  188. lblTitleSeries.font=orderTextFont;
  189. [_contentView addSubview:lblTitleSeries];
  190. _lblSeriesName = [[UILabel alloc]init];
  191. _lblSeriesName.frame=CGRectMake(CGRectGetMaxX(lblTitleSeries.frame),CGRectGetMaxY(lblTitleVariety.frame)+ypadding,250, 25);
  192. _lblSeriesName.font=orderTextFont;
  193. [_contentView addSubview:_lblSeriesName];
  194. UILabel *lblTitleColorNumber = [[UILabel alloc]init];
  195. lblTitleColorNumber.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSeries.frame)+ypadding,80,25);
  196. lblTitleColorNumber.text=@"色 号:";
  197. lblTitleColorNumber.font=orderTextFont;
  198. [_contentView addSubview:lblTitleColorNumber];
  199. _lblColorNumber = [[UILabel alloc]init];
  200. _lblColorNumber.frame=CGRectMake(CGRectGetMaxX(lblTitleColorNumber.frame),CGRectGetMaxY(lblTitleSeries.frame)+ypadding,250, 25);
  201. _lblColorNumber.font=orderTextFont;
  202. [_contentView addSubview:_lblColorNumber];
  203. UILabel *lblTitleGrade = [[UILabel alloc]init];
  204. lblTitleGrade.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleColorNumber.frame)+ypadding,80,25);
  205. lblTitleGrade.text=@"等 级:";
  206. lblTitleGrade.font=orderTextFont;
  207. [_contentView addSubview:lblTitleGrade];
  208. _lblGradeName = [[UILabel alloc]init];
  209. _lblGradeName.frame=CGRectMake(CGRectGetMaxX(lblTitleGrade.frame),CGRectGetMaxY(lblTitleColorNumber.frame)+ypadding,250, 25);
  210. _lblGradeName.font=orderTextFont;
  211. [_contentView addSubview:_lblGradeName];
  212. UILabel *lblTitleWarehouse = [[UILabel alloc]init];
  213. lblTitleWarehouse.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleGrade.frame)+ypadding,80,25);
  214. lblTitleWarehouse.text=@"库 区:";
  215. lblTitleWarehouse.font=orderTextFont;
  216. [_contentView addSubview:lblTitleWarehouse];
  217. _lblWarehouseName = [[UILabel alloc]init];
  218. _lblWarehouseName.frame=CGRectMake(CGRectGetMaxX(lblTitleWarehouse.frame),CGRectGetMaxY(lblTitleGrade.frame)+ypadding,250, 25);
  219. _lblWarehouseName.font=orderTextFont;
  220. [_contentView addSubview:_lblWarehouseName];
  221. UILabel *lblTitlePositionNumber = [[UILabel alloc]init];
  222. lblTitlePositionNumber.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleWarehouse.frame)+ypadding,80,25);
  223. lblTitlePositionNumber.text=@"仓 位 号:";
  224. lblTitlePositionNumber.font=orderTextFont;
  225. [_contentView addSubview:lblTitlePositionNumber];
  226. _lblPositionNumber = [[UILabel alloc]init];
  227. _lblPositionNumber.frame=CGRectMake(CGRectGetMaxX(lblTitlePositionNumber.frame),CGRectGetMaxY(lblTitleWarehouse.frame)+ypadding,250, 25);
  228. _lblPositionNumber.font=orderTextFont;
  229. [_contentView addSubview:_lblPositionNumber];
  230. UILabel *lblTitleSpecification = [[UILabel alloc]init];
  231. lblTitleSpecification.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitlePositionNumber.frame)+ypadding,80,25);
  232. lblTitleSpecification.text=@"规 格:";
  233. lblTitleSpecification.font=orderTextFont;
  234. [_contentView addSubview:lblTitleSpecification];
  235. _lblSpecification = [[UILabel alloc]init];
  236. _lblSpecification.frame=CGRectMake(CGRectGetMaxX(lblTitleSpecification.frame),CGRectGetMaxY(lblTitlePositionNumber.frame)+ypadding,250, 25);
  237. _lblSpecification.font=orderTextFont;
  238. [_contentView addSubview:_lblSpecification];
  239. UILabel *lblTitleWeight = [[UILabel alloc]init];
  240. lblTitleWeight.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSpecification.frame)+ypadding,80,25);
  241. lblTitleWeight.text=@"重 量:";
  242. lblTitleWeight.font=orderTextFont;
  243. [_contentView addSubview:lblTitleWeight];
  244. _lblWeight = [[UILabel alloc]init];
  245. _lblWeight.frame=CGRectMake(CGRectGetMaxX(lblTitleWeight.frame),CGRectGetMaxY(lblTitleSpecification.frame)+ypadding,250, 25);
  246. _lblWeight.font=orderTextFont;
  247. [_contentView addSubview:_lblWeight];
  248. UILabel *lblTitleAreage = [[UILabel alloc]init];
  249. lblTitleAreage.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleWeight.frame)+ypadding,80,25);
  250. lblTitleAreage.text=@"面 积:";
  251. lblTitleAreage.font=orderTextFont;
  252. [_contentView addSubview:lblTitleAreage];
  253. _lblAcreage = [[UILabel alloc]init];
  254. _lblAcreage.frame=CGRectMake(CGRectGetMaxX(lblTitleAreage.frame),CGRectGetMaxY(lblTitleWeight.frame)+ypadding,250, 25);
  255. _lblAcreage.font=orderTextFont;
  256. [_contentView addSubview:_lblAcreage];
  257. UILabel *lblTitlePackage = [[UILabel alloc]init];
  258. lblTitlePackage.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleAreage.frame)+ypadding,80,25);
  259. lblTitlePackage.text=@"包 装:";
  260. lblTitlePackage.font=orderTextFont;
  261. [_contentView addSubview:lblTitlePackage];
  262. _lblPackage = [[UILabel alloc]init];
  263. _lblPackage.frame=CGRectMake(CGRectGetMaxX(lblTitlePackage.frame),CGRectGetMaxY(lblTitleAreage.frame)+ypadding,250, 25);
  264. _lblPackage.font=orderTextFont;
  265. [_contentView addSubview:_lblPackage];
  266. UILabel *lblTitleInventoryQuantity = [[UILabel alloc]init];
  267. lblTitleInventoryQuantity.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitlePackage.frame)+ypadding,80,25);
  268. lblTitleInventoryQuantity.text=@"库 存 量:";
  269. lblTitleInventoryQuantity.font=orderTextFont;
  270. [_contentView addSubview:lblTitleInventoryQuantity];
  271. _lblInventoryQuantity = [[UILabel alloc]init];
  272. _lblInventoryQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleInventoryQuantity.frame),CGRectGetMaxY(lblTitlePackage.frame)+ypadding,250, 25);
  273. _lblInventoryQuantity.font=orderTextFont;
  274. [_contentView addSubview:_lblInventoryQuantity];
  275. UILabel *lblTitleOccupyQuantity = [[UILabel alloc]init];
  276. lblTitleOccupyQuantity.frame=CGRectMake(xpadding,CGRectGetMaxY( lblTitleInventoryQuantity.frame)+ypadding,80,25);
  277. lblTitleOccupyQuantity.text=@"占 库 量:";
  278. lblTitleOccupyQuantity.font=orderTextFont;
  279. [_contentView addSubview:lblTitleOccupyQuantity];
  280. _lblOccupyQuantity = [[UILabel alloc]init];
  281. _lblOccupyQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleOccupyQuantity.frame),CGRectGetMaxY( lblTitleInventoryQuantity.frame)+ypadding,250, 25);
  282. _lblOccupyQuantity.font=orderTextFont;
  283. [_contentView addSubview:_lblOccupyQuantity];
  284. UILabel *lblTitleFreezeQuantity = [[UILabel alloc]init];
  285. lblTitleFreezeQuantity.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleOccupyQuantity.frame)+ypadding,80,25);
  286. lblTitleFreezeQuantity.text=@"冻 结 量:";
  287. lblTitleFreezeQuantity.font=orderTextFont;
  288. [_contentView addSubview:lblTitleFreezeQuantity];
  289. _lblFreezeQuantity = [[UILabel alloc]init];
  290. _lblFreezeQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleFreezeQuantity.frame),CGRectGetMaxY(lblTitleOccupyQuantity.frame)+ypadding,250, 25);
  291. _lblFreezeQuantity.font=orderTextFont;
  292. [_contentView addSubview:_lblFreezeQuantity];
  293. UILabel *lblTitleNoDeliveryQuantity = [[UILabel alloc]init];
  294. lblTitleNoDeliveryQuantity.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleFreezeQuantity.frame)+ypadding,80,25);
  295. lblTitleNoDeliveryQuantity.text=@"未 提 量:";
  296. lblTitleNoDeliveryQuantity.font=orderTextFont;
  297. [_contentView addSubview:lblTitleNoDeliveryQuantity];
  298. _lblNoDeliveryQuantity = [[UILabel alloc]init];
  299. _lblNoDeliveryQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleNoDeliveryQuantity.frame),CGRectGetMaxY(lblTitleFreezeQuantity.frame)+ypadding,250, 25);
  300. _lblNoDeliveryQuantity.font=orderTextFont;
  301. [_contentView addSubview:_lblNoDeliveryQuantity];
  302. UILabel *lblTitleNoEnterQuantity = [[UILabel alloc]init];
  303. lblTitleNoEnterQuantity.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleNoDeliveryQuantity.frame)+ypadding,80,25);
  304. lblTitleNoEnterQuantity.text=@"未 入 量:";
  305. lblTitleNoEnterQuantity.font=orderTextFont;
  306. [_contentView addSubview:lblTitleNoEnterQuantity];
  307. _lblNoEnterQuantity = [[UILabel alloc]init];
  308. _lblNoEnterQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleNoEnterQuantity.frame),CGRectGetMaxY(lblTitleNoDeliveryQuantity.frame)+ypadding,250, 25);
  309. _lblNoEnterQuantity.font=orderTextFont;
  310. [_contentView addSubview:_lblNoEnterQuantity];
  311. UILabel *lblTitleBalanceQuantity = [[UILabel alloc]init];
  312. lblTitleBalanceQuantity.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleNoEnterQuantity.frame)+ypadding,80,25);
  313. lblTitleBalanceQuantity.text=@"可 售 量:";
  314. lblTitleBalanceQuantity.font=orderTextFont;
  315. [_contentView addSubview:lblTitleBalanceQuantity];
  316. _lblBalanceQuantity = [[UILabel alloc]init];
  317. _lblBalanceQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleBalanceQuantity.frame),CGRectGetMaxY(lblTitleNoEnterQuantity.frame)+ypadding,250, 25);
  318. _lblBalanceQuantity.font=orderTextFont;
  319. [_contentView addSubview:_lblBalanceQuantity];
  320. _contentView.frame=CGRectMake(10,10, Screen_Width-20, CGRectGetMaxY( lblTitleBalanceQuantity.frame));
  321. _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, CGRectGetMaxY(_contentView.frame)+10, 85, 0)];
  322. [_imageView setUserInteractionEnabled:YES];
  323. _singleTap =[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onClickImage)];
  324. [_imageView addGestureRecognizer:_singleTap];
  325. [_scroll addSubview:_imageView];
  326. _scroll.contentSize=CGSizeMake(self.view.frame.size.width, CGRectGetMaxY(_imageView.frame));
  327. }
  328. /**
  329. 图片点击事件
  330. */
  331. - (void) onClickImage {
  332. NSMutableArray *arr = [[NSMutableArray alloc] init];
  333. [arr addObject:_imageView];
  334. XHImageViewer *imageViewer = [[XHImageViewer alloc] init];
  335. imageViewer.delegate = self;
  336. [imageViewer showWithImageViews:arr selectedView:_imageView];
  337. [_imageView removeGestureRecognizer:_singleTap];
  338. }
  339. /**
  340. 图片缩小添加手势
  341. @param imageViewer
  342. @param selectedView
  343. */
  344. - (void)imageViewer:(XHImageViewer *)imageViewer willDismissWithSelectedView:(UIImageView*)selectedView {
  345. [_imageView addGestureRecognizer:_singleTap];
  346. }
  347. /**
  348. 加载数据函数
  349. */
  350. - (void)loadData
  351. {
  352. self.mDownManager = [[ASIDownManager alloc] init];
  353. _mDownManager.delegate = self;
  354. _mDownManager.OnImageDown = @selector(onLoadFinish:);
  355. _mDownManager.OnImageFail = @selector(onLoadFail:);
  356. [self startLoading];
  357. NSString *urlStr = ServerURL;
  358. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  359. [dict setObject:@"GetInventoryDetailIphone" forKey:@"Action"];
  360. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  361. [dict setObject:kkUserCode forKey:@"UserCode"];
  362. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  363. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  364. [dict setObject:_inventoryId forKey:@"InventoryID"];
  365. [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  366. }
  367. /**
  368. 进度条取消
  369. */
  370. - (void)cancel {
  371. [self stopLoading];
  372. }
  373. @end