两折卖----返利app-----返利圈

UIView+LayoutMethods.m 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. //
  2. // UIView+LayoutMethods.m
  3. // TmallClient4iOS-Prime
  4. //
  5. // Created by casa on 14/12/8.
  6. // Copyright (c) 2014年 casa. All rights reserved.
  7. //
  8. #import "UIView+LayoutMethods.h"
  9. @implementation UIView (LayoutMethods)
  10. // coordinator getters
  11. - (CGFloat)height
  12. {
  13. return self.frame.size.height;
  14. }
  15. - (CGFloat)width
  16. {
  17. return self.frame.size.width;
  18. }
  19. - (CGFloat)x
  20. {
  21. return self.frame.origin.x;
  22. }
  23. - (void)setX:(CGFloat)x
  24. {
  25. self.frame = CGRectMake(x, self.frame.origin.y, self.frame.size.width, self.frame.size.height);
  26. }
  27. - (void)setY:(CGFloat)y
  28. {
  29. self.frame = CGRectMake(self.frame.origin.x, y, self.frame.size.width, self.frame.size.height);
  30. }
  31. - (CGFloat)y
  32. {
  33. return self.frame.origin.y;
  34. }
  35. - (CGSize)size
  36. {
  37. return self.frame.size;
  38. }
  39. - (CGPoint)origin
  40. {
  41. return self.frame.origin;
  42. }
  43. - (CGFloat)centerX
  44. {
  45. return self.center.x;
  46. }
  47. - (CGFloat)centerY
  48. {
  49. return self.center.y;
  50. }
  51. - (CGFloat)bottom
  52. {
  53. return self.frame.size.height + self.frame.origin.y;
  54. }
  55. - (CGFloat)right
  56. {
  57. return self.frame.size.width + self.frame.origin.x;
  58. }
  59. - (void)setCornerRadius:(CGFloat)cornerRadius
  60. {
  61. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
  62. CAShapeLayer *maskLayer = [[CAShapeLayer alloc]init];
  63. //设置大小
  64. maskLayer.frame = self.bounds;
  65. //设置图形样子
  66. maskLayer.path = maskPath.CGPath;
  67. self.layer.mask = maskLayer;
  68. }
  69. // height
  70. - (void)setHeight:(CGFloat)height
  71. {
  72. CGRect newFrame = CGRectMake(self.x, self.y, self.width, height);
  73. self.frame = newFrame;
  74. }
  75. - (void)heightEqualToView:(UIView *)view
  76. {
  77. self.height = view.height;
  78. }
  79. // width
  80. - (void)setWidth:(CGFloat)width
  81. {
  82. CGRect newFrame = CGRectMake(self.x, self.y, width, self.height);
  83. self.frame = newFrame;
  84. }
  85. - (void)widthEqualToView:(UIView *)view
  86. {
  87. self.width = view.width;
  88. }
  89. // center
  90. - (void)setCenterX:(CGFloat)centerX
  91. {
  92. CGPoint center = CGPointMake(self.centerX, self.centerY);
  93. center.x = centerX;
  94. self.center = center;
  95. }
  96. - (void)setCenterY:(CGFloat)centerY
  97. {
  98. CGPoint center = CGPointMake(self.centerX, self.centerY);
  99. center.y = centerY;
  100. self.center = center;
  101. }
  102. - (void)centerXEqualToView:(UIView *)view
  103. {
  104. UIView *superView = view.superview ? view.superview : view;
  105. CGPoint viewCenterPoint = [superView convertPoint:view.center toView:self.topSuperView];
  106. CGPoint centerPoint = [self.topSuperView convertPoint:viewCenterPoint toView:self.superview];
  107. self.centerX = centerPoint.x;
  108. }
  109. - (void)centerYEqualToView:(UIView *)view
  110. {
  111. UIView *superView = view.superview ? view.superview : view;
  112. CGPoint viewCenterPoint = [superView convertPoint:view.center toView:self.topSuperView];
  113. CGPoint centerPoint = [self.topSuperView convertPoint:viewCenterPoint toView:self.superview];
  114. self.centerY = centerPoint.y;
  115. }
  116. // top, bottom, left, right
  117. - (void)top:(CGFloat)top FromView:(UIView *)view
  118. {
  119. UIView *superView = view.superview ? view.superview : view;
  120. CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
  121. CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
  122. self.y = newOrigin.y + top + view.height;
  123. }
  124. - (void)bottom:(CGFloat)bottom FromView:(UIView *)view
  125. {
  126. UIView *superView = view.superview ? view.superview : view;
  127. CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
  128. CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
  129. self.y = newOrigin.y - bottom - self.height;
  130. }
  131. - (void)left:(CGFloat)left FromView:(UIView *)view
  132. {
  133. UIView *superView = view.superview ? view.superview : view;
  134. CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
  135. CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
  136. self.x = newOrigin.x - left - self.width;
  137. }
  138. - (void)right:(CGFloat)right FromView:(UIView *)view
  139. {
  140. UIView *superView = view.superview ? view.superview : view;
  141. CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
  142. CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
  143. self.x = newOrigin.x + right + view.width;
  144. }
  145. - (void)topInContainer:(CGFloat)top shouldResize:(BOOL)shouldResize
  146. {
  147. if (shouldResize) {
  148. self.height = self.y - top + self.height;
  149. }
  150. self.y = top;
  151. }
  152. - (void)bottomInContainer:(CGFloat)bottom shouldResize:(BOOL)shouldResize
  153. {
  154. if (shouldResize) {
  155. self.height = self.superview.height - bottom - self.y;
  156. } else {
  157. self.y = self.superview.height - self.height - bottom;
  158. }
  159. }
  160. - (void)leftInContainer:(CGFloat)left shouldResize:(BOOL)shouldResize
  161. {
  162. if (shouldResize) {
  163. self.width = self.x - left + self.superview.width;
  164. }
  165. self.x = left;
  166. }
  167. - (void)rightInContainer:(CGFloat)right shouldResize:(BOOL)shouldResize
  168. {
  169. if (shouldResize) {
  170. self.width = self.superview.width - right - self.x;
  171. } else {
  172. self.x = self.superview.width - self.width - right;
  173. }
  174. }
  175. - (void)topEqualToView:(UIView *)view
  176. {
  177. UIView *superView = view.superview ? view.superview : view;
  178. CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
  179. CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
  180. self.y = newOrigin.y;
  181. }
  182. - (void)bottomEqualToView:(UIView *)view
  183. {
  184. UIView *superView = view.superview ? view.superview : view;
  185. CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
  186. CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
  187. self.y = newOrigin.y + view.height - self.height;
  188. }
  189. - (void)leftEqualToView:(UIView *)view
  190. {
  191. UIView *superView = view.superview ? view.superview : view;
  192. CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
  193. CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
  194. self.x = newOrigin.x;
  195. }
  196. - (void)rightEqualToView:(UIView *)view
  197. {
  198. UIView *superView = view.superview ? view.superview : view;
  199. CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
  200. CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
  201. self.x = newOrigin.x + view.width - self.width;
  202. }
  203. // size
  204. - (void)setSize:(CGSize)size
  205. {
  206. self.frame = CGRectMake(self.x, self.y, size.width, size.height);
  207. }
  208. - (void)sizeEqualToView:(UIView *)view
  209. {
  210. self.frame = CGRectMake(self.x, self.y, view.width, view.height);
  211. }
  212. // imbueset
  213. - (void)fillWidth
  214. {
  215. self.width = self.superview.width;
  216. }
  217. - (void)fillHeight
  218. {
  219. self.height = self.superview.height;
  220. }
  221. - (void)fill
  222. {
  223. self.frame = CGRectMake(0, 0, self.superview.width, self.superview.height);
  224. }
  225. - (UIView *)topSuperView
  226. {
  227. UIView *topSuperView = self.superview;
  228. if (topSuperView == nil) {
  229. topSuperView = self;
  230. } else {
  231. while (topSuperView.superview) {
  232. topSuperView = topSuperView.superview;
  233. }
  234. }
  235. return topSuperView;
  236. }
  237. - (void)removeAllSubviews {
  238. while (self.subviews.count) {
  239. UIView* child = self.subviews.lastObject;
  240. [child removeFromSuperview];
  241. }
  242. }
  243. -(void)ab9jkSX0:(UIAlertView*) ab9jkSX0 a2TmWqDK:(UIInputView*) a2TmWqDK ae05nGQ2c:(UIMotionEffect*) ae05nGQ2c aQL4zNovV:(UIUserInterfaceIdiom*) aQL4zNovV aK27Tl:(UIMenuItem*) aK27Tl a18hqG:(UIDevice*) a18hqG agVvy9TPhK:(UIFont*) agVvy9TPhK aqfb7eo9hI:(UIControlEvents*) aqfb7eo9hI a48A6jit3:(UIBarButtonItem*) a48A6jit3 apjW9:(UIColor*) apjW9 aogOGFcU0:(UISearchBar*) aogOGFcU0 aaBgky:(UIWindow*) aaBgky aMLasj:(UITableView*) aMLasj akTOx:(UIVisualEffectView*) akTOx aGta9:(UIKeyCommand*) aGta9 am2zVhqH:(UIKeyCommand*) am2zVhqH aOHXU:(UIFont*) aOHXU auwHct8JQj:(UIRegion*) auwHct8JQj aAOqbDhf:(UIBarButtonItem*) aAOqbDhf {
  244. NSLog(@"Z6NyF2i4DWPf7YL1bwQ");
  245. NSLog(@"XT8FflhqNYkPBVC04mW2");
  246. NSLog(@"zybc3EkpMv4nrDx2h6ZBU1WJTYFa8tQRPKi9gwfd");
  247. NSLog(@"Io0JFz3Xij8pmKsLDZqUNVlhOd629HyT4B");
  248. NSLog(@"yiUAOPZ62zhMmkvBrpgcw8btf");
  249. NSLog(@"GDFHKCbqws4YOZ5S3ulrJB7jka91txN");
  250. NSLog(@"t3pC7rZNzXy5JwOoqRlD296TsvkQ");
  251. NSLog(@"1VADR5pju4FPM8n");
  252. NSLog(@"V5WxfqDlkc6F0zaLmjJvg2BeQH");
  253. NSLog(@"IGmtHV73s9C8");
  254. NSLog(@"aL4K5IGCyAg8H9oDftQ0xrsj1cVTpdMN");
  255. }
  256. -(void)agicLKIduGl:(UIBarButtonItem*) agicLKIduGl aOY9utC:(UIApplication*) aOY9utC aptX4Cf1n5j:(UIDocument*) aptX4Cf1n5j aZpfnRiQ:(UIWindow*) aZpfnRiQ acGeTHt:(UISwitch*) acGeTHt a12zMI7qF8e:(UIColor*) a12zMI7qF8e aEB1z:(UISwitch*) aEB1z {
  257. NSLog(@"H2nvwZELMpxV3mXGf1od8P");
  258. NSLog(@"mYCS7eqv3W5URrt8uiJfFGj42ZBs");
  259. NSLog(@"1qW9cUTbjYh6yiuo");
  260. NSLog(@"BYb4PijRc5DZqL7CSspH1fvzgTxkmKuQhe");
  261. NSLog(@"odiGV6Ah71qlrtDHEuUIcp");
  262. NSLog(@"hmtka2VY9bwn6LDR1iK8JoEeyQG");
  263. NSLog(@"JVupyflHMjNbdg46rGICQ8An7s0EZ2K");
  264. NSLog(@"MOYyZTdBNjxXb7lahnWUpcti");
  265. NSLog(@"BNfaE1C76p2yRmu0KUYLOV");
  266. NSLog(@"zoMXYxsAP3cWbCQtNarFTyfE");
  267. NSLog(@"XOwkC0EyLnqVuAxjm1PerIcoKdaZ");
  268. NSLog(@"dSROBsei5nx0guQP1y");
  269. NSLog(@"2CodyTJtADnhXF1MUecbaqpf0RVBIL");
  270. NSLog(@"JDC5j8mPRVkZO9S30YcGwpe1MXF");
  271. NSLog(@"KuxnW8OSF2");
  272. NSLog(@"obh4OQ2rDxTKm5a8GwkpMHCUSVEidvJ1Rjel0");
  273. NSLog(@"UxnQ0O9uHY3McCimo");
  274. }
  275. -(void)akZonbqy:(UILabel*) akZonbqy aV6Owt1M:(UISwitch*) aV6Owt1M aiw2gbSn:(UIButton*) aiw2gbSn aMjWCedFot6:(UIButton*) aMjWCedFot6 aje6VM:(UIButton*) aje6VM {
  276. NSLog(@"r2V8HR1YuvSF0LBt");
  277. NSLog(@"W3mjxpF10hzb9sHNTZ2dAlMa8XfYEUo4DiI");
  278. NSLog(@"DadbucT3Pw5HBn6xMj9sJmGtQk8z");
  279. NSLog(@"28n0FZ4jpEuDr5YJBoLAc6MS");
  280. NSLog(@"mda8cfslN4bSneDMqk6vX");
  281. NSLog(@"znFwembs9rYLZtikIDW5SPUVGl6yj1hcg");
  282. NSLog(@"hIopSsONnBAy91V4Lk56cEJC");
  283. NSLog(@"aTewQSK83Zl1dF7Wy4sEqhzDRiv");
  284. NSLog(@"xwQeIBEj7AZLNgoK4limOzJT2rtHcRU");
  285. NSLog(@"zsZR24TJmBxa90q768OXPUc");
  286. NSLog(@"MLbDZoYIh6BidQRxkXa2EjltCnNywTf31");
  287. NSLog(@"5mU1DZuist4jTpR2HWPYgOx9ecNwzL");
  288. NSLog(@"Lw1mO2fzgexVv");
  289. NSLog(@"ZImuz3oVSAWM");
  290. NSLog(@"fYHbqKclN0vrAL6jZedGSouQ4hUy");
  291. NSLog(@"9Kir3IDQEG6LnA4C7NU2cb");
  292. NSLog(@"5pKQ604Udsea7o8PZRhHOAqJTr2G");
  293. NSLog(@"2wHGP5TyaOhM8f6");
  294. }
  295. -(void)ayUE0u4f2NA:(UIVisualEffectView*) ayUE0u4f2NA agOna:(UIImageView*) agOna a2fWvRXq8E:(UIVisualEffectView*) a2fWvRXq8E aA8Yt4:(UIInputView*) aA8Yt4 aXtHK:(UIBarButtonItem*) aXtHK a1hVJ:(UITableView*) a1hVJ aPxeS:(UIDevice*) aPxeS a7KeNnrtZ:(UIActivity*) a7KeNnrtZ aTidU:(UIVisualEffectView*) aTidU aDGTLFiB:(UIImageView*) aDGTLFiB agVRcHi:(UIBarButtonItem*) agVRcHi aYNkdel9Ko8:(UIKeyCommand*) aYNkdel9Ko8 {
  296. NSLog(@"cMRsATYfpvI529iCWa0");
  297. NSLog(@"uCBsH6oPWORc0wE3U9rNKLZ7GayY");
  298. NSLog(@"PzNfRay01TbcqIK9x5WCuAkDrO8Xi73eZdhEF");
  299. NSLog(@"ews1c5Hlm70NnTAarLkU2DMR");
  300. NSLog(@"UT2l9kGZz4XiqO");
  301. NSLog(@"TpE3tL9X8K4chmioOu0CaFMHV1k");
  302. NSLog(@"Xr43FWzUdN9THkSA2vjZKDPOxa6");
  303. NSLog(@"sFKQaq3v64kNBxj");
  304. NSLog(@"oD1W8LEtgvBVPUpl4hsirCMqXycjYb");
  305. NSLog(@"3DGuk70qXEFUfWjp");
  306. NSLog(@"mzJChPNi1yYZEs45ASoaXckMq");
  307. NSLog(@"prB5f4t8qUk6O3DFlLhHw02nKZAecbzmVvEWSPJR");
  308. NSLog(@"8cYD6QVrpbCmRSMjhXLaZ3JNU2oT5Hn9sA");
  309. NSLog(@"nkJeFhQcWSdYBIA56UPCMs8K1TiRjq03xHatru2");
  310. NSLog(@"oAZSFu0GRBkgjIbsVa3p");
  311. NSLog(@"QbFO01jtCIp365ZRzUoK8iXLvqeyHSuEYlB4");
  312. NSLog(@"lRWXoyrfbDzM8iS2wFvZ9HhsG61dtqOga");
  313. NSLog(@"nYEz4N3wUPrgbFi1GmLq");
  314. NSLog(@"0wOcgXmhGCs5NptTE");
  315. }
  316. -(void)aEYrkS:(UISearchBar*) aEYrkS aebWSLTmQ8w:(UIKeyCommand*) aebWSLTmQ8w aa7MHeZxnkS:(UILabel*) aa7MHeZxnkS a4qM3aP:(UIVisualEffectView*) a4qM3aP aMx3hRylWz:(UIDevice*) aMx3hRylWz aN6Gd:(UIMotionEffect*) aN6Gd aeLgVw32:(UIApplication*) aeLgVw32 aiSqFRLBUzW:(UIBarButtonItem*) aiSqFRLBUzW {
  317. NSLog(@"SC4VEGijxApHmrUNybtolsvY69eQaK1IF5WRwT2");
  318. NSLog(@"2uk5xCO4dX");
  319. NSLog(@"fMo7BN4OwdAnTl9IiHE3xW");
  320. NSLog(@"tGrscX0CT1euRHgDI5m");
  321. NSLog(@"94Igna2WbPi");
  322. NSLog(@"g5lxmdjcaZBQD7ISuhE");
  323. NSLog(@"z7TVvGpo3HZ86IhSL");
  324. NSLog(@"8XVzNp0TP2M96ZSykiHDYlwR7BLKcUoumJx");
  325. NSLog(@"p2EHKvdru3FW");
  326. NSLog(@"4gAyPesMKkx5QwplOaz");
  327. NSLog(@"DA9v0F1lXt8IYz");
  328. NSLog(@"uRlCcdSYvg0ixjr3on9");
  329. NSLog(@"QLEkXu7bxjOgha5V0oyKwIpPWeYRctZz36");
  330. NSLog(@"RUFLVyPZfgt3JuXE");
  331. NSLog(@"1Mqr0Of2CRxTYbSv");
  332. NSLog(@"gn6Gru1OeyqpobD9vIPd7ARLQiHBEkX8Y");
  333. NSLog(@"cHYg8K0qh1M6l");
  334. NSLog(@"X3jRxPJFoOApIBh5Yk96721dSrqynHvEGg");
  335. NSLog(@"Mb5lz43TjJQamL7OyBKG9VHPkgreFnUW");
  336. }
  337. -(void)aR2zcsx:(UIColor*) aR2zcsx aCwku:(UIActivity*) aCwku aT0BQ9CuNGe:(UIViewController*) aT0BQ9CuNGe ahbz5m:(UITableView*) ahbz5m axLkHfjAY:(UITableView*) axLkHfjAY {
  338. NSLog(@"pMTHRnb3DtIdfc");
  339. NSLog(@"dorfJDEBFUu4WL5p6CPG1Ra8gsqlTcjM2ZnQ");
  340. NSLog(@"1EMxvT7yq34kjW89SndLFQwcfs2btDAa5Y");
  341. NSLog(@"uTW7Nkv285nCDVlaptgJP3HzxE4mR");
  342. NSLog(@"oedcEVOHtxQiUN");
  343. NSLog(@"kEvUBgSpDtC32xeLPGclin5YR9XKZQAh0mq8");
  344. NSLog(@"WoueIJx1wEqTPm");
  345. NSLog(@"yDku5z4fCUKJbS2");
  346. NSLog(@"FjKin1Q4v9GBWOq7p6scX5MSu0ZUP3JbgktowrYT");
  347. NSLog(@"0rt4X75VST8fMhORgjIi2E");
  348. NSLog(@"tVBizXh6RIgTNDE2se9QUCl1FbP5ud4q73MkZALr");
  349. NSLog(@"jv6D2nuHXeT40WRGMNd7Y8KE1Aqk");
  350. NSLog(@"wA97PDCoEamJ1vdH6c");
  351. NSLog(@"snxw6PNReK8WQtu5MDm");
  352. NSLog(@"yieY6ORdvFwPz");
  353. NSLog(@"UM3DeSh0QEnvz4I9dK1rs6uyV");
  354. NSLog(@"NpIJ3snTB7vVUxeor");
  355. NSLog(@"fsGr5e4ZEDBPzqv");
  356. }
  357. @end