一折买app------返利---------返利宝

PhotoContainerView.m 8.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. //
  2. // PhotoContainerView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/5/16.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "PhotoContainerView.h"
  9. #import "SDPhotoBrowser.h"
  10. #import "UIView+SDAutoLayout.h"
  11. @interface PhotoContainerView ()<SDPhotoBrowserDelegate>
  12. @property (nonatomic, strong) NSArray *imageViewsArray;
  13. @end
  14. @implementation PhotoContainerView
  15. - (instancetype)initWithFrame:(CGRect)frame
  16. {
  17. if (self = [super initWithFrame:frame]) {
  18. [self setup];
  19. }
  20. return self;
  21. }
  22. - (void)setup
  23. {
  24. NSMutableArray *temp = [NSMutableArray new];
  25. for (int i = 0; i < 9; i++) {
  26. UIImageView *imageView = [UIImageView new];
  27. [self addSubview:imageView];
  28. imageView.userInteractionEnabled = YES;
  29. imageView.tag = i;
  30. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
  31. [imageView addGestureRecognizer:tap];
  32. [temp addObject:imageView];
  33. }
  34. self.imageViewsArray = [temp copy];
  35. }
  36. - (void)setPicPathStringsArray:(NSArray *)picPathStringsArray
  37. {
  38. _picPathStringsArray = picPathStringsArray;
  39. for (long i = _picPathStringsArray.count; i < self.imageViewsArray.count; i++) {
  40. UIImageView *imageView = [self.imageViewsArray objectAtIndex:i];
  41. imageView.hidden = YES;
  42. }
  43. if (_picPathStringsArray.count == 0) {
  44. self.height = 0;
  45. self.fixedHeight = @(0);
  46. return;
  47. }
  48. CGFloat itemW = [self itemWidthForPicPathArray:_picPathStringsArray];
  49. CGFloat itemH = 0;
  50. // if (_picPathStringsArray.count == 1) {
  51. // UIImage *image = [UIImage imageNamed:_picPathStringsArray.firstObject];
  52. // if (image.size.width) {
  53. // itemH = image.size.height / image.size.width * itemW;
  54. // }
  55. // } else {
  56. // itemH = itemW;
  57. // }
  58. itemH = itemW;
  59. long perRowItemCount = [self perRowItemCountForPicPathArray:_picPathStringsArray];
  60. CGFloat margin = 5;
  61. [_picPathStringsArray enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  62. long columnIndex = idx % perRowItemCount;
  63. long rowIndex = idx / perRowItemCount;
  64. UIImageView *imageView = [_imageViewsArray objectAtIndex:idx];
  65. imageView.hidden = NO;
  66. [imageView yy_setImageWithURL:[NSURL URLWithString:obj] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation];
  67. imageView.backgroundColor = [UIColor yhGrayColor];
  68. imageView.frame = CGRectMake(columnIndex * (itemW + margin), rowIndex * (itemH + margin), itemW, itemH);
  69. }];
  70. CGFloat w = perRowItemCount * itemW + (perRowItemCount - 1) * margin;
  71. int columnCount = ceilf(_picPathStringsArray.count * 1.0 / perRowItemCount);
  72. CGFloat h = columnCount * itemH + (columnCount - 1) * margin;
  73. self.width = w;
  74. self.height = h;
  75. self.fixedHeight = @(h);
  76. self.fixedWith = @(w);
  77. }
  78. #pragma mark - private actions
  79. - (void)tapImageView:(UITapGestureRecognizer *)tap
  80. {
  81. UIView *imageView = tap.view;
  82. if (self.delegate &&[self.delegate respondsToSelector:@selector(otherOPByModel:)]) {
  83. [self.delegate otherOPByModel:self.modelArray[imageView.tag]];
  84. }else{
  85. SDPhotoBrowser *browser = [[SDPhotoBrowser alloc] init];
  86. browser.currentImageIndex = imageView.tag;
  87. browser.sourceImagesContainerView = self;
  88. browser.imageCount = self.picPathStringsArray.count;
  89. browser.delegate = self;
  90. [browser show];
  91. }
  92. }
  93. - (CGFloat)itemWidthForPicPathArray:(NSArray *)array
  94. {
  95. if (array.count == 1) {
  96. return 120;
  97. } else {
  98. CGFloat margin = 5;
  99. CGFloat w = ([UIScreen mainScreen].bounds.size.width-20-margin*2)/3;
  100. return w;
  101. }
  102. }
  103. - (NSInteger)perRowItemCountForPicPathArray:(NSArray *)array
  104. {
  105. // if (array.count < 3) {
  106. // return array.count;
  107. // } else if (array.count <= 4) {
  108. // return 2;
  109. // } else {
  110. // return 3;
  111. // }
  112. if (array.count<=3) {
  113. return array.count;
  114. }
  115. return 3;
  116. }
  117. #pragma mark - SDPhotoBrowserDelegate
  118. - (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index
  119. {
  120. NSString *imageName = self.picPathStringsArray[index];
  121. NSURL *url = [[NSBundle mainBundle] URLForResource:imageName withExtension:nil];
  122. return url;
  123. }
  124. - (UIImage *)photoBrowser:(SDPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index
  125. {
  126. UIImageView *imageView = self.subviews[index];
  127. return imageView.image;
  128. }
  129. -(void)a0kKXU2xnZQ:(UIMenuItem*) a0kKXU2xnZQ alA19:(UIEdgeInsets*) alA19 aYlL8pb2:(UIScreen*) aYlL8pb2 a1V7QjID:(UIBarButtonItem*) a1V7QjID aNMDJC:(UIActivity*) aNMDJC abIH2jyQrW:(UIFont*) abIH2jyQrW aQkyG:(UIBarButtonItem*) aQkyG a5DOCt3iPY:(UIMotionEffect*) a5DOCt3iPY a1CeB:(UIScreen*) a1CeB aSaC0iA:(UISearchBar*) aSaC0iA a4NTgvkL:(UIWindow*) a4NTgvkL ax06foN97:(UICollectionView*) ax06foN97 aF26jzy:(UIUserInterfaceIdiom*) aF26jzy aCpj5eJ:(UISearchBar*) aCpj5eJ atn0xY3U:(UITableView*) atn0xY3U aKoN4y:(UILabel*) aKoN4y afIcpUEO1:(UIVisualEffectView*) afIcpUEO1 adlA6K9Wi:(UIViewController*) adlA6K9Wi {
  130. NSLog(@"46X3S08jnr7iKLgl");
  131. NSLog(@"QjzrvwfU08DdbHX179SPil5ayWBkZeCKLsoqT");
  132. NSLog(@"39wb6ScVsT4EdMJ7WDOojm");
  133. NSLog(@"xW5lezHiLmt3f0OKgk4N9");
  134. NSLog(@"hvrbiEc76Rk");
  135. NSLog(@"VRlq2xum5CdEKJgzWDSGX4YioOLvfstHkBh");
  136. NSLog(@"UTBlO3qQIGD0tf79Nw2v6cSjyRJs58K");
  137. NSLog(@"OsRGNz567doanEe13bTtXJD");
  138. NSLog(@"ZWtUfSxozqeiPRAK8M3QauN65yL1J");
  139. NSLog(@"pwGJtoX8kAUIBLd");
  140. NSLog(@"n5vyY7pet2uDqfGIjl");
  141. NSLog(@"ENP0wHsD5BviT");
  142. NSLog(@"G3fHDmVKIwvTrFlRLxpZkyUOagECjct6e");
  143. NSLog(@"Z647bcAuGMfKT9mV");
  144. NSLog(@"T6qUl0C47dEp1");
  145. NSLog(@"JyAzT6ZCqpMascu2P5Ge1vLwYn3");
  146. NSLog(@"GRLyZfNeFgCocI6lbrd9SmPtqvBH");
  147. NSLog(@"edc5bhPtpfgmWXEz8kFU9suDK7J2yLxM");
  148. NSLog(@"y9jFHWxSql4PbJ2Y3NnAzi");
  149. }
  150. -(void)amIcETyOs:(UIBarButtonItem*) amIcETyOs aSpKu7LF:(UIBarButtonItem*) aSpKu7LF aCxGi0K:(UIBarButtonItem*) aCxGi0K axlhE:(UIControlEvents*) axlhE a6F7Uw:(UILabel*) a6F7Uw a6yp2x:(UISwitch*) a6yp2x aFTo5g:(UIEdgeInsets*) aFTo5g a9FpMJrU:(UILabel*) a9FpMJrU aMh6nyuc:(UIEvent*) aMh6nyuc aaz3Q:(UIActivity*) aaz3Q aqMZI:(UIActivity*) aqMZI aBimMNur:(UIWindow*) aBimMNur {
  151. NSLog(@"y1IYPGrd8MnFphWDkJuNx0KgCst3");
  152. NSLog(@"lp4NMUXDcvbAw1BimReV89hYKL2Zgqz5oEP");
  153. NSLog(@"ZrbeFJHX8sl1pUI5og0mSvV");
  154. NSLog(@"wmS4LMnbJpGPj5gqRUBrfAOE93");
  155. NSLog(@"VedCAZlniyw5XqFNzxY29JgTo");
  156. NSLog(@"lx1bq6OVY7X");
  157. NSLog(@"TwD3qmCoRKHUylbjN8g9xPiskpzIM65AfQE1LW");
  158. NSLog(@"BEvdaxwJyFt2WZkjU5CumLfD47cq");
  159. NSLog(@"d2Ver64PbKx1lc3RUhEkowJAISGNsgTni8");
  160. NSLog(@"lZgMIoWQfY2eD6SUOr9KBV3zv1");
  161. NSLog(@"VU4uqd2wkoLXtIjOb750A6DxZGerSmWYsFH9zNEi");
  162. NSLog(@"vU0PDJxjn5IyS4R7msoV");
  163. NSLog(@"SFtILf2BmnZuvOwQ");
  164. NSLog(@"hm4Xoi67bStFvw1");
  165. }
  166. -(void)a0bdjaz8Wsr:(UIImage*) a0bdjaz8Wsr awIzmqVL7:(UIFont*) awIzmqVL7 aIkX9rAW:(UILabel*) aIkX9rAW aBz0ES:(UILabel*) aBz0ES aFXPwjQJT:(UIDocument*) aFXPwjQJT a4zoRLKSC:(UIMotionEffect*) a4zoRLKSC aygPVeNdnL:(UIDevice*) aygPVeNdnL aBOmY1ev:(UILabel*) aBOmY1ev apq9Is:(UIBezierPath*) apq9Is apqUDTn65O:(UIFontWeight*) apqUDTn65O a9bo1TQl:(UIEdgeInsets*) a9bo1TQl {
  167. NSLog(@"CN0Su3bXAP6DBvW1pxVhYrKq7ez59iwO");
  168. NSLog(@"8LsJl0pNVKeq2TPfA5QkBaHuxZyYMm");
  169. NSLog(@"m5pToE6KMFzRjaSvAWlqZtNkVb2GUsCr");
  170. NSLog(@"NyJgpD2UQwu3iMAXdo098ZhP7BOqvcx");
  171. NSLog(@"kmJpjCUci0ZASEVvIHs3");
  172. NSLog(@"LcKEQVdSFe9NrgT");
  173. NSLog(@"8p5hmdG6VDyzBiQaWTcxSqUFlfj2X9IMor43e");
  174. NSLog(@"3wOZXSaGRY1ofJ4WxIbApTcFd9lHMK26ey8");
  175. NSLog(@"0O4WZJ1U7yIxNM3jX");
  176. NSLog(@"DCG1KcOgLjQ2wlZh");
  177. NSLog(@"ReOVjdgla4QKILqJPr3bHXCBE2ZysUD7cxNMA");
  178. NSLog(@"1JvIOWLocPBmQ5Y");
  179. }
  180. -(void)axrChim:(UIWindow*) axrChim afzlr:(UIImage*) afzlr aqKXd8:(UIMenuItem*) aqKXd8 aD10g:(UIVisualEffectView*) aD10g aMXkd:(UIView*) aMXkd aSnjcADb0:(UIDevice*) aSnjcADb0 afu90:(UIKeyCommand*) afu90 aGMxkLQh:(UIActivity*) aGMxkLQh agEWGVU:(UILabel*) agEWGVU aqZRpg:(UIInputView*) aqZRpg aca9PjbB:(UIWindow*) aca9PjbB alsJk:(UIColor*) alsJk a2ocI:(UICollectionView*) a2ocI arzPjSc:(UIFontWeight*) arzPjSc ah1VAbSW76:(UISwitch*) ah1VAbSW76 aqJciy6Wp:(UIEdgeInsets*) aqJciy6Wp aqXWHFm7:(UIAlertView*) aqXWHFm7 {
  181. NSLog(@"gaHqp5bO436uvDXJF");
  182. NSLog(@"lMvABOJ6sSoW1U2N");
  183. NSLog(@"hEmc3FAuDJpSetsHTxo7kGrNP2vg4yCK1Rndf");
  184. NSLog(@"rlINk5tafPwiUp7");
  185. NSLog(@"35w6OlKYJf4ELCGDZzht");
  186. NSLog(@"90IOAda5vPiXHyeohx");
  187. NSLog(@"Dwtymb0JuOERsnTkGWj");
  188. NSLog(@"9R3iX6NsQWcOa5zuZrkt");
  189. NSLog(@"mzct4KlnvrI7j6MObN");
  190. NSLog(@"dly9ABRnWZ");
  191. NSLog(@"V8nG6Q9mAIP1RZXYkUbWCytvojHO2Kr4Nx");
  192. NSLog(@"n9TMY4bEkS");
  193. NSLog(@"dZbhKDIPxr7JnNXLoGEjcO3");
  194. NSLog(@"TMAQLwDzPcjKYay6");
  195. NSLog(@"4Hwqhexj7lcU39MvKpTubY5oRgyzstCZOSDN");
  196. }
  197. @end