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

UIView+LayoutMethods.m 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  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)aVPalZyOoxC:(UIFontWeight*) aVPalZyOoxC a4TJ8b:(UIEvent*) a4TJ8b akcdqi:(UIDevice*) akcdqi aJKc0uY2weG:(UIMotionEffect*) aJKc0uY2weG aUnt9SJbGD:(UIButton*) aUnt9SJbGD a8hJvt:(UIRegion*) a8hJvt anQujCYNx:(UIColor*) anQujCYNx a27pcty:(UIBarButtonItem*) a27pcty aDkE7p3Bgo1:(UITableView*) aDkE7p3Bgo1 ap9wur:(UIFont*) ap9wur {
  244. NSLog(@"EGCSTHq1wgBvinRflXA0KZd8mDFPbWUVxp");
  245. NSLog(@"buAHSK4E7GYZrC2haoc9U6Qkx5p");
  246. NSLog(@"P6IhuQepBZxFElrN98wsfYqdKGAX");
  247. NSLog(@"HmOi8nvL1TyPSrb4DthwMYRe9p");
  248. NSLog(@"IdextABTcSJiYUsH7E9F02hyKC3Q6V1mZlv");
  249. NSLog(@"sytczUASrDgR3iP27dxoLJhjlmCMN");
  250. NSLog(@"dSpGYPqtkciLD1FJKvTw");
  251. NSLog(@"oiHFnacz4TsEbJU2VMxX691NyGwCqKS8jdkpv");
  252. NSLog(@"qDGKxpgwOJA1bjnvXo53rzWHfCmL");
  253. NSLog(@"1rC5ps0839RPYKmNDGShbIqEXOiZt");
  254. NSLog(@"BLEVWFq9rmuPXJnpSaQC8f4zDeo3NgO6iRH1Tt");
  255. NSLog(@"pQ0aADhNOXwUb32rZEMvIjPK");
  256. NSLog(@"Xc3yVhJTGt7I1fPO2Y");
  257. NSLog(@"CfuxOJ4L2biRzDPMA");
  258. NSLog(@"O1QnCV6JYf0Bpi9gLXabFP");
  259. NSLog(@"HmB9JEQDlPdOpry6");
  260. NSLog(@"QvF0V9OR1S8xed");
  261. NSLog(@"0nETQJUbh6XHFts9S1fgvBDARuycm2");
  262. }
  263. -(void)aynj9JxBPc:(UIKeyCommand*) aynj9JxBPc aOTWzol1xUi:(UIControlEvents*) aOTWzol1xUi aYoBE:(UIControl*) aYoBE a3kBM:(UIAlertView*) a3kBM a8dSgUqj1Z:(UIMenuItem*) a8dSgUqj1Z a0WYbmIieo:(UIApplication*) a0WYbmIieo a4qegv:(UIActivity*) a4qegv atOc1RJ:(UILabel*) atOc1RJ a3Rl0Z:(UIBarButtonItem*) a3Rl0Z aMYkAdqnweJ:(UIControl*) aMYkAdqnweJ audl6CO4KEg:(UIDevice*) audl6CO4KEg azhj2F0KGw:(UIRegion*) azhj2F0KGw auiFG:(UIBezierPath*) auiFG aKpSFoThD:(UIInputView*) aKpSFoThD aSUHJaT:(UIVisualEffectView*) aSUHJaT {
  264. NSLog(@"m9gUpIdl8unY3WPbyvH");
  265. NSLog(@"dU2QY7cyWlJgwpuZmkxt9VSnAfOC");
  266. NSLog(@"OsH9XyTJwnB5xlaWY1GKgPckoADE8IR");
  267. NSLog(@"iKUyYWExCqOvdARXnHga4NbDIZ9r7");
  268. NSLog(@"1Jq0OFzMfGb4KB");
  269. NSLog(@"uG3Mh6p09Sq1cPAxrt7HRVvmozXagN");
  270. NSLog(@"XBUtTzq7L9E451uAfgeKYidwx0o");
  271. NSLog(@"oIETPVY7qBp5mM82AgzrX");
  272. NSLog(@"90br8vKmEIWsQYVqlGt5Ca6Zwp7123iAcx4hy");
  273. NSLog(@"aQngkGpcEu3xtUXRsoS18");
  274. NSLog(@"TNoq5mAF79V8tJOLWhCZUYvcgyGsSkMuz0lB");
  275. NSLog(@"0KwE7eqWzJdvAy53bjtgupFXM");
  276. NSLog(@"klKSpx0ravhPy96ojDAuMNJFB");
  277. NSLog(@"oLz2JVcKYwmx9vnCNju");
  278. }
  279. -(void)as5dIKZjeJv:(UIControl*) as5dIKZjeJv aNRbnio0:(UIViewController*) aNRbnio0 aG03u6:(UIScreen*) aG03u6 a3utg89s6:(UIApplication*) a3utg89s6 aBGTi:(UIActivity*) aBGTi a5M40LTY:(UIVisualEffectView*) a5M40LTY aGUL1:(UIActivity*) aGUL1 ardi6VBnu4f:(UIRegion*) ardi6VBnu4f aRHv9cdkatf:(UIImage*) aRHv9cdkatf auY6VboChH:(UIUserInterfaceIdiom*) auY6VboChH aecfq0m:(UITableView*) aecfq0m aTEmH:(UIImageView*) aTEmH a6q8jvyro4:(UIButton*) a6q8jvyro4 aNDVbxs5KW:(UIFontWeight*) aNDVbxs5KW asXgbJ3y8mu:(UIApplication*) asXgbJ3y8mu aFmt3Wz:(UIApplication*) aFmt3Wz a1mVolF:(UIMenuItem*) a1mVolF {
  280. NSLog(@"0PvIF7OmBX31J");
  281. NSLog(@"1Cg7f6QhETPD2qiA");
  282. NSLog(@"O63sdzR0pFW8AQMLPeUwNVnGb1tjHiE");
  283. NSLog(@"iGbUMOIowEq3v9m56PCQ7jNsWh1uAxd2p");
  284. NSLog(@"UZRQ9cHz4MWv50qChKPbI8SiFaXDV");
  285. NSLog(@"KLycgf59lM718SFDU");
  286. NSLog(@"c4LqWySxRkJnFae");
  287. NSLog(@"uPIK78Qgw50ayYGOknis6jFf4BVAo3rHT");
  288. NSLog(@"9dQZEhNtmi");
  289. NSLog(@"Yow5Z8sfkgOm4Xl");
  290. NSLog(@"OVaMqUKXoTy9mZWi");
  291. NSLog(@"UN1PtwcfZS4gHu826i7nzADMJ");
  292. }
  293. -(void)aPaKtkELJ:(UIImage*) aPaKtkELJ agU4FoEqh9:(UIInputView*) agU4FoEqh9 aQ0lVNHCf5:(UIRegion*) aQ0lVNHCf5 anih2b:(UIBezierPath*) anih2b alFtOG:(UIBezierPath*) alFtOG aFMWIdXDxR:(UIApplication*) aFMWIdXDxR axvgy4h0Pc1:(UIControl*) axvgy4h0Pc1 ajeCmoqPM:(UIEvent*) ajeCmoqPM aNanu5V74:(UIBarButtonItem*) aNanu5V74 ajc159:(UIButton*) ajc159 amKyNnPxo:(UIViewController*) amKyNnPxo aZ1URpVM5i:(UILabel*) aZ1URpVM5i a68oQfG7:(UIBezierPath*) a68oQfG7 aCgNXq:(UIMotionEffect*) aCgNXq as0Pmc:(UIFont*) as0Pmc alicPC7:(UIWindow*) alicPC7 a7NEqaegIh4:(UIActivity*) a7NEqaegIh4 {
  294. NSLog(@"OF6xSlmjMGsXcrPLCUv41RHB2zJ78peWYbTdE");
  295. NSLog(@"BH1VlG7FvM4kXo3Pbq5CIfSTgu");
  296. NSLog(@"RYd5y6fKo7XEFnsh");
  297. NSLog(@"y7VRpkC6gUNaSrLTXviGDBdIAnOc8Z0bJz4");
  298. NSLog(@"UAhG3Myzotbj");
  299. NSLog(@"NBf0x7bTwAOyY581WRCopeZMh");
  300. NSLog(@"Sx4FBDNvfGsgq35EY1nCzQmUHWyiI9LoM67");
  301. NSLog(@"eYiAdUrZLf8mK71XqzgwMFJWGbHC4VDsNIyh0a");
  302. NSLog(@"f9v6AuGVca4RIEUDeJMNX1B28K");
  303. NSLog(@"SIEX9nfO37NeJ1Dj0vhHlkcGbVK2BwtLyd");
  304. NSLog(@"XEBuUcP1m5hsCjerkwdp0GoJZ");
  305. NSLog(@"vtjz1RqkKEHLByeg2P3wxSo96apI");
  306. NSLog(@"FBqRryMdLhYw25Nxi73VpCD4GsAbfO");
  307. NSLog(@"f9WGQpgdaUEXPje24M5oHBSrhblqtiuA0LcJ7VOv");
  308. }
  309. -(void)aJhMeW62tCS:(UIButton*) aJhMeW62tCS aecY0nVJ:(UIKeyCommand*) aecY0nVJ auIh31MenqZ:(UIColor*) auIh31MenqZ amKMDN:(UIColor*) amKMDN ahFkvP:(UIVisualEffectView*) ahFkvP aFYC51:(UISearchBar*) aFYC51 azQ8RaLk1IE:(UIDevice*) azQ8RaLk1IE aA5IcY:(UIVisualEffectView*) aA5IcY aRb1IF9:(UIAlertView*) aRb1IF9 {
  310. NSLog(@"qrb2LhpsCOfFRjDQlGdV5yawBoXUEWY");
  311. NSLog(@"Ike7fYSUsLuGmt");
  312. NSLog(@"sNHARQDbyugzOFr");
  313. NSLog(@"HU3nVv2jd5gZlYy0Pq6TxwzNt91rhL7BbX8J");
  314. NSLog(@"HMApoCtgBD2vJkqxPjZW5c8X0UYuENs34");
  315. NSLog(@"bp3Qse7yf2KtJNFL4WuvZU9");
  316. NSLog(@"Urp42tHlhsSkcLVBCP9F1vxTNDbKQqge8GORX");
  317. NSLog(@"3nhLpgmCQdbrtyzaci9lq4T6F");
  318. NSLog(@"DGmvsQ2bPrzLH7");
  319. NSLog(@"W6RMNK1dmrw0vJZQSOTFnDbYPE9clas");
  320. NSLog(@"TsMCcg6AxFNIWoEjPU0Zda31lDfuSJyBzi2k");
  321. NSLog(@"VnYJrNGkm51L49ZS2Kjzg7CPUDB0hqcaRi");
  322. NSLog(@"FRzdYn8rTa5bOEXJkLCHNDjVWQg23");
  323. NSLog(@"Oph1XsITaxb8HotiF9NvnzE7K3gSyALw");
  324. NSLog(@"6fd21xK3ejyInchl0rvJowgsX4uC7NREiaAS");
  325. NSLog(@"EJtTXBvVq1o9Ia");
  326. NSLog(@"neGKWcHzaZMjVODPU2AImi4");
  327. }
  328. -(void)a2qyUN:(UIWindow*) a2qyUN aIJKZvfko:(UISwitch*) aIJKZvfko aasU2JKlGW0:(UIButton*) aasU2JKlGW0 axCYMbVeR:(UIImage*) axCYMbVeR aIWMASKvQ:(UIImageView*) aIWMASKvQ aKYpi97:(UIBarButtonItem*) aKYpi97 {
  329. NSLog(@"vi1unYzdy6oTcwG7Rq");
  330. NSLog(@"ioWp8QlejmLuOTI05rht4aqXgBC9zF");
  331. NSLog(@"A5oBtmei7TX3NxYIM");
  332. NSLog(@"6CKtpRg4JF27chubjyAimT");
  333. NSLog(@"yl5XKgqISYaVwDtciFM8O7neku4r9JU6Nv1mb30");
  334. NSLog(@"04eZERrvudPUI31QswK2DFhoajqWNSp5HtOn");
  335. NSLog(@"mUWhrzs8xjGXfenwO2i1RyHp4qK0QAYVc");
  336. NSLog(@"IPRYGcAEhuqKoW0Obw9JaefsyntvX4jMU");
  337. NSLog(@"9YVhW8jKu7yeUr");
  338. NSLog(@"mOMKjF0ADQV");
  339. }
  340. -(void)arVv8:(UIInputView*) arVv8 a257PgGQML:(UIMotionEffect*) a257PgGQML avrPGlmtMK:(UIEdgeInsets*) avrPGlmtMK aR8oXZ4HEIG:(UIScreen*) aR8oXZ4HEIG aT1vQbF7V:(UITableView*) aT1vQbF7V avRc3:(UIViewController*) avRc3 a2FBIheGjuZ:(UIEdgeInsets*) a2FBIheGjuZ aPvN1CS:(UIControl*) aPvN1CS avGNRaj:(UILabel*) avGNRaj aaR0sepY4o:(UIKeyCommand*) aaR0sepY4o azMkJNh6Z8x:(UIActivity*) azMkJNh6Z8x {
  341. NSLog(@"UQXHmGiYfzdlAwrVPNpJyOjoR4vcZB");
  342. NSLog(@"JoK204q7M1IzfimEsLlvgCY35bpkdAOxD");
  343. NSLog(@"Y8xS7ams16NfD");
  344. NSLog(@"Rwl1KYLW0DxpjdCsyFPQIOa9V6ZBiHbG2UeS4g");
  345. NSLog(@"umxSj1Ten8M5p");
  346. NSLog(@"25Qxi3Gs4r");
  347. NSLog(@"8zDYdtIQkBVa4vXRmMLxOuC5ZUKie0fJyjbT");
  348. NSLog(@"NaMUKwxWgQq3pd7Eje6Y5c2kzFXnoTuS1s90y");
  349. NSLog(@"As9jcWLplbdx8o4FNfq2aI3gKvBwDPST");
  350. NSLog(@"QtjHNGcRDMozs3lwdiO1S27eyk9fpKEF8Ju0b");
  351. NSLog(@"Hm2fwDxvh7ky5nY0u18iPKaTQbNcpsqXW4Jl6EG");
  352. NSLog(@"rtj3MVSh1mU7z95gvKHd");
  353. NSLog(@"VwN3LTdGUKCi8lOp");
  354. }
  355. @end