123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411 |
- //
- // UIView+LayoutMethods.m
- // TmallClient4iOS-Prime
- //
- // Created by casa on 14/12/8.
- // Copyright (c) 2014年 casa. All rights reserved.
- //
- #import "UIView+LayoutMethods.h"
- @implementation UIView (LayoutMethods)
- // coordinator getters
- - (CGFloat)height
- {
- return self.frame.size.height;
- }
- - (CGFloat)width
- {
- return self.frame.size.width;
- }
- - (CGFloat)x
- {
- return self.frame.origin.x;
- }
- - (void)setX:(CGFloat)x
- {
- self.frame = CGRectMake(x, self.frame.origin.y, self.frame.size.width, self.frame.size.height);
- }
- - (void)setY:(CGFloat)y
- {
- self.frame = CGRectMake(self.frame.origin.x, y, self.frame.size.width, self.frame.size.height);
- }
- - (CGFloat)y
- {
- return self.frame.origin.y;
- }
- - (CGSize)size
- {
- return self.frame.size;
- }
- - (CGPoint)origin
- {
- return self.frame.origin;
- }
- - (CGFloat)centerX
- {
- return self.center.x;
- }
- - (CGFloat)centerY
- {
- return self.center.y;
- }
- - (CGFloat)bottom
- {
- return self.frame.size.height + self.frame.origin.y;
- }
- - (CGFloat)right
- {
- return self.frame.size.width + self.frame.origin.x;
- }
- - (void)setCornerRadius:(CGFloat)cornerRadius
- {
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
-
- CAShapeLayer *maskLayer = [[CAShapeLayer alloc]init];
- //设置大小
- maskLayer.frame = self.bounds;
- //设置图形样子
- maskLayer.path = maskPath.CGPath;
- self.layer.mask = maskLayer;
- }
- // height
- - (void)setHeight:(CGFloat)height
- {
- CGRect newFrame = CGRectMake(self.x, self.y, self.width, height);
- self.frame = newFrame;
- }
- - (void)heightEqualToView:(UIView *)view
- {
- self.height = view.height;
- }
- // width
- - (void)setWidth:(CGFloat)width
- {
- CGRect newFrame = CGRectMake(self.x, self.y, width, self.height);
- self.frame = newFrame;
- }
- - (void)widthEqualToView:(UIView *)view
- {
- self.width = view.width;
- }
- // center
- - (void)setCenterX:(CGFloat)centerX
- {
- CGPoint center = CGPointMake(self.centerX, self.centerY);
- center.x = centerX;
- self.center = center;
- }
- - (void)setCenterY:(CGFloat)centerY
- {
- CGPoint center = CGPointMake(self.centerX, self.centerY);
- center.y = centerY;
- self.center = center;
- }
- - (void)centerXEqualToView:(UIView *)view
- {
- UIView *superView = view.superview ? view.superview : view;
- CGPoint viewCenterPoint = [superView convertPoint:view.center toView:self.topSuperView];
- CGPoint centerPoint = [self.topSuperView convertPoint:viewCenterPoint toView:self.superview];
- self.centerX = centerPoint.x;
- }
- - (void)centerYEqualToView:(UIView *)view
- {
- UIView *superView = view.superview ? view.superview : view;
- CGPoint viewCenterPoint = [superView convertPoint:view.center toView:self.topSuperView];
- CGPoint centerPoint = [self.topSuperView convertPoint:viewCenterPoint toView:self.superview];
- self.centerY = centerPoint.y;
- }
- // top, bottom, left, right
- - (void)top:(CGFloat)top FromView:(UIView *)view
- {
- UIView *superView = view.superview ? view.superview : view;
- CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
- CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
-
- self.y = newOrigin.y + top + view.height;
- }
- - (void)bottom:(CGFloat)bottom FromView:(UIView *)view
- {
- UIView *superView = view.superview ? view.superview : view;
- CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
- CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
-
- self.y = newOrigin.y - bottom - self.height;
- }
- - (void)left:(CGFloat)left FromView:(UIView *)view
- {
- UIView *superView = view.superview ? view.superview : view;
- CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
- CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
-
- self.x = newOrigin.x - left - self.width;
- }
- - (void)right:(CGFloat)right FromView:(UIView *)view
- {
- UIView *superView = view.superview ? view.superview : view;
- CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
- CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
-
- self.x = newOrigin.x + right + view.width;
- }
- - (void)topInContainer:(CGFloat)top shouldResize:(BOOL)shouldResize
- {
- if (shouldResize) {
- self.height = self.y - top + self.height;
- }
- self.y = top;
- }
- - (void)bottomInContainer:(CGFloat)bottom shouldResize:(BOOL)shouldResize
- {
- if (shouldResize) {
- self.height = self.superview.height - bottom - self.y;
- } else {
- self.y = self.superview.height - self.height - bottom;
- }
- }
- - (void)leftInContainer:(CGFloat)left shouldResize:(BOOL)shouldResize
- {
- if (shouldResize) {
- self.width = self.x - left + self.superview.width;
- }
- self.x = left;
- }
- - (void)rightInContainer:(CGFloat)right shouldResize:(BOOL)shouldResize
- {
- if (shouldResize) {
- self.width = self.superview.width - right - self.x;
- } else {
- self.x = self.superview.width - self.width - right;
- }
- }
- - (void)topEqualToView:(UIView *)view
- {
- UIView *superView = view.superview ? view.superview : view;
- CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
- CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
-
- self.y = newOrigin.y;
- }
- - (void)bottomEqualToView:(UIView *)view
- {
- UIView *superView = view.superview ? view.superview : view;
- CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
- CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
-
- self.y = newOrigin.y + view.height - self.height;
- }
- - (void)leftEqualToView:(UIView *)view
- {
- UIView *superView = view.superview ? view.superview : view;
- CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
- CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
-
- self.x = newOrigin.x;
- }
- - (void)rightEqualToView:(UIView *)view
- {
- UIView *superView = view.superview ? view.superview : view;
- CGPoint viewOrigin = [superView convertPoint:view.origin toView:self.topSuperView];
- CGPoint newOrigin = [self.topSuperView convertPoint:viewOrigin toView:self.superview];
-
- self.x = newOrigin.x + view.width - self.width;
- }
- // size
- - (void)setSize:(CGSize)size
- {
- self.frame = CGRectMake(self.x, self.y, size.width, size.height);
- }
- - (void)sizeEqualToView:(UIView *)view
- {
- self.frame = CGRectMake(self.x, self.y, view.width, view.height);
- }
- // imbueset
- - (void)fillWidth
- {
- self.width = self.superview.width;
- }
- - (void)fillHeight
- {
- self.height = self.superview.height;
- }
- - (void)fill
- {
- self.frame = CGRectMake(0, 0, self.superview.width, self.superview.height);
- }
- - (UIView *)topSuperView
- {
- UIView *topSuperView = self.superview;
-
- if (topSuperView == nil) {
- topSuperView = self;
- } else {
- while (topSuperView.superview) {
- topSuperView = topSuperView.superview;
- }
- }
-
- return topSuperView;
- }
- - (void)removeAllSubviews {
- while (self.subviews.count) {
- UIView* child = self.subviews.lastObject;
- [child removeFromSuperview];
- }
- }
- -(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 {
- NSLog(@"Z6NyF2i4DWPf7YL1bwQ");
- NSLog(@"XT8FflhqNYkPBVC04mW2");
- NSLog(@"zybc3EkpMv4nrDx2h6ZBU1WJTYFa8tQRPKi9gwfd");
- NSLog(@"Io0JFz3Xij8pmKsLDZqUNVlhOd629HyT4B");
- NSLog(@"yiUAOPZ62zhMmkvBrpgcw8btf");
- NSLog(@"GDFHKCbqws4YOZ5S3ulrJB7jka91txN");
- NSLog(@"t3pC7rZNzXy5JwOoqRlD296TsvkQ");
- NSLog(@"1VADR5pju4FPM8n");
- NSLog(@"V5WxfqDlkc6F0zaLmjJvg2BeQH");
- NSLog(@"IGmtHV73s9C8");
- NSLog(@"aL4K5IGCyAg8H9oDftQ0xrsj1cVTpdMN");
- }
- -(void)agicLKIduGl:(UIBarButtonItem*) agicLKIduGl aOY9utC:(UIApplication*) aOY9utC aptX4Cf1n5j:(UIDocument*) aptX4Cf1n5j aZpfnRiQ:(UIWindow*) aZpfnRiQ acGeTHt:(UISwitch*) acGeTHt a12zMI7qF8e:(UIColor*) a12zMI7qF8e aEB1z:(UISwitch*) aEB1z {
- NSLog(@"H2nvwZELMpxV3mXGf1od8P");
- NSLog(@"mYCS7eqv3W5URrt8uiJfFGj42ZBs");
- NSLog(@"1qW9cUTbjYh6yiuo");
- NSLog(@"BYb4PijRc5DZqL7CSspH1fvzgTxkmKuQhe");
- NSLog(@"odiGV6Ah71qlrtDHEuUIcp");
- NSLog(@"hmtka2VY9bwn6LDR1iK8JoEeyQG");
- NSLog(@"JVupyflHMjNbdg46rGICQ8An7s0EZ2K");
- NSLog(@"MOYyZTdBNjxXb7lahnWUpcti");
- NSLog(@"BNfaE1C76p2yRmu0KUYLOV");
- NSLog(@"zoMXYxsAP3cWbCQtNarFTyfE");
- NSLog(@"XOwkC0EyLnqVuAxjm1PerIcoKdaZ");
- NSLog(@"dSROBsei5nx0guQP1y");
- NSLog(@"2CodyTJtADnhXF1MUecbaqpf0RVBIL");
- NSLog(@"JDC5j8mPRVkZO9S30YcGwpe1MXF");
- NSLog(@"KuxnW8OSF2");
- NSLog(@"obh4OQ2rDxTKm5a8GwkpMHCUSVEidvJ1Rjel0");
- NSLog(@"UxnQ0O9uHY3McCimo");
- }
- -(void)akZonbqy:(UILabel*) akZonbqy aV6Owt1M:(UISwitch*) aV6Owt1M aiw2gbSn:(UIButton*) aiw2gbSn aMjWCedFot6:(UIButton*) aMjWCedFot6 aje6VM:(UIButton*) aje6VM {
- NSLog(@"r2V8HR1YuvSF0LBt");
- NSLog(@"W3mjxpF10hzb9sHNTZ2dAlMa8XfYEUo4DiI");
- NSLog(@"DadbucT3Pw5HBn6xMj9sJmGtQk8z");
- NSLog(@"28n0FZ4jpEuDr5YJBoLAc6MS");
- NSLog(@"mda8cfslN4bSneDMqk6vX");
- NSLog(@"znFwembs9rYLZtikIDW5SPUVGl6yj1hcg");
- NSLog(@"hIopSsONnBAy91V4Lk56cEJC");
- NSLog(@"aTewQSK83Zl1dF7Wy4sEqhzDRiv");
- NSLog(@"xwQeIBEj7AZLNgoK4limOzJT2rtHcRU");
- NSLog(@"zsZR24TJmBxa90q768OXPUc");
- NSLog(@"MLbDZoYIh6BidQRxkXa2EjltCnNywTf31");
- NSLog(@"5mU1DZuist4jTpR2HWPYgOx9ecNwzL");
- NSLog(@"Lw1mO2fzgexVv");
- NSLog(@"ZImuz3oVSAWM");
- NSLog(@"fYHbqKclN0vrAL6jZedGSouQ4hUy");
- NSLog(@"9Kir3IDQEG6LnA4C7NU2cb");
- NSLog(@"5pKQ604Udsea7o8PZRhHOAqJTr2G");
- NSLog(@"2wHGP5TyaOhM8f6");
- }
- -(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 {
- NSLog(@"cMRsATYfpvI529iCWa0");
- NSLog(@"uCBsH6oPWORc0wE3U9rNKLZ7GayY");
- NSLog(@"PzNfRay01TbcqIK9x5WCuAkDrO8Xi73eZdhEF");
- NSLog(@"ews1c5Hlm70NnTAarLkU2DMR");
- NSLog(@"UT2l9kGZz4XiqO");
- NSLog(@"TpE3tL9X8K4chmioOu0CaFMHV1k");
- NSLog(@"Xr43FWzUdN9THkSA2vjZKDPOxa6");
- NSLog(@"sFKQaq3v64kNBxj");
- NSLog(@"oD1W8LEtgvBVPUpl4hsirCMqXycjYb");
- NSLog(@"3DGuk70qXEFUfWjp");
- NSLog(@"mzJChPNi1yYZEs45ASoaXckMq");
- NSLog(@"prB5f4t8qUk6O3DFlLhHw02nKZAecbzmVvEWSPJR");
- NSLog(@"8cYD6QVrpbCmRSMjhXLaZ3JNU2oT5Hn9sA");
- NSLog(@"nkJeFhQcWSdYBIA56UPCMs8K1TiRjq03xHatru2");
- NSLog(@"oAZSFu0GRBkgjIbsVa3p");
- NSLog(@"QbFO01jtCIp365ZRzUoK8iXLvqeyHSuEYlB4");
- NSLog(@"lRWXoyrfbDzM8iS2wFvZ9HhsG61dtqOga");
- NSLog(@"nYEz4N3wUPrgbFi1GmLq");
- NSLog(@"0wOcgXmhGCs5NptTE");
- }
- -(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 {
- NSLog(@"SC4VEGijxApHmrUNybtolsvY69eQaK1IF5WRwT2");
- NSLog(@"2uk5xCO4dX");
- NSLog(@"fMo7BN4OwdAnTl9IiHE3xW");
- NSLog(@"tGrscX0CT1euRHgDI5m");
- NSLog(@"94Igna2WbPi");
- NSLog(@"g5lxmdjcaZBQD7ISuhE");
- NSLog(@"z7TVvGpo3HZ86IhSL");
- NSLog(@"8XVzNp0TP2M96ZSykiHDYlwR7BLKcUoumJx");
- NSLog(@"p2EHKvdru3FW");
- NSLog(@"4gAyPesMKkx5QwplOaz");
- NSLog(@"DA9v0F1lXt8IYz");
- NSLog(@"uRlCcdSYvg0ixjr3on9");
- NSLog(@"QLEkXu7bxjOgha5V0oyKwIpPWeYRctZz36");
- NSLog(@"RUFLVyPZfgt3JuXE");
- NSLog(@"1Mqr0Of2CRxTYbSv");
- NSLog(@"gn6Gru1OeyqpobD9vIPd7ARLQiHBEkX8Y");
- NSLog(@"cHYg8K0qh1M6l");
- NSLog(@"X3jRxPJFoOApIBh5Yk96721dSrqynHvEGg");
- NSLog(@"Mb5lz43TjJQamL7OyBKG9VHPkgreFnUW");
- }
- -(void)aR2zcsx:(UIColor*) aR2zcsx aCwku:(UIActivity*) aCwku aT0BQ9CuNGe:(UIViewController*) aT0BQ9CuNGe ahbz5m:(UITableView*) ahbz5m axLkHfjAY:(UITableView*) axLkHfjAY {
- NSLog(@"pMTHRnb3DtIdfc");
- NSLog(@"dorfJDEBFUu4WL5p6CPG1Ra8gsqlTcjM2ZnQ");
- NSLog(@"1EMxvT7yq34kjW89SndLFQwcfs2btDAa5Y");
- NSLog(@"uTW7Nkv285nCDVlaptgJP3HzxE4mR");
- NSLog(@"oedcEVOHtxQiUN");
- NSLog(@"kEvUBgSpDtC32xeLPGclin5YR9XKZQAh0mq8");
- NSLog(@"WoueIJx1wEqTPm");
- NSLog(@"yDku5z4fCUKJbS2");
- NSLog(@"FjKin1Q4v9GBWOq7p6scX5MSu0ZUP3JbgktowrYT");
- NSLog(@"0rt4X75VST8fMhORgjIi2E");
- NSLog(@"tVBizXh6RIgTNDE2se9QUCl1FbP5ud4q73MkZALr");
- NSLog(@"jv6D2nuHXeT40WRGMNd7Y8KE1Aqk");
- NSLog(@"wA97PDCoEamJ1vdH6c");
- NSLog(@"snxw6PNReK8WQtu5MDm");
- NSLog(@"yieY6ORdvFwPz");
- NSLog(@"UM3DeSh0QEnvz4I9dK1rs6uyV");
- NSLog(@"NpIJ3snTB7vVUxeor");
- NSLog(@"fsGr5e4ZEDBPzqv");
- }
- @end
|