123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409 |
- //
- // 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)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 {
- NSLog(@"EGCSTHq1wgBvinRflXA0KZd8mDFPbWUVxp");
- NSLog(@"buAHSK4E7GYZrC2haoc9U6Qkx5p");
- NSLog(@"P6IhuQepBZxFElrN98wsfYqdKGAX");
- NSLog(@"HmOi8nvL1TyPSrb4DthwMYRe9p");
- NSLog(@"IdextABTcSJiYUsH7E9F02hyKC3Q6V1mZlv");
- NSLog(@"sytczUASrDgR3iP27dxoLJhjlmCMN");
- NSLog(@"dSpGYPqtkciLD1FJKvTw");
- NSLog(@"oiHFnacz4TsEbJU2VMxX691NyGwCqKS8jdkpv");
- NSLog(@"qDGKxpgwOJA1bjnvXo53rzWHfCmL");
- NSLog(@"1rC5ps0839RPYKmNDGShbIqEXOiZt");
- NSLog(@"BLEVWFq9rmuPXJnpSaQC8f4zDeo3NgO6iRH1Tt");
- NSLog(@"pQ0aADhNOXwUb32rZEMvIjPK");
- NSLog(@"Xc3yVhJTGt7I1fPO2Y");
- NSLog(@"CfuxOJ4L2biRzDPMA");
- NSLog(@"O1QnCV6JYf0Bpi9gLXabFP");
- NSLog(@"HmB9JEQDlPdOpry6");
- NSLog(@"QvF0V9OR1S8xed");
- NSLog(@"0nETQJUbh6XHFts9S1fgvBDARuycm2");
- }
- -(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 {
- NSLog(@"m9gUpIdl8unY3WPbyvH");
- NSLog(@"dU2QY7cyWlJgwpuZmkxt9VSnAfOC");
- NSLog(@"OsH9XyTJwnB5xlaWY1GKgPckoADE8IR");
- NSLog(@"iKUyYWExCqOvdARXnHga4NbDIZ9r7");
- NSLog(@"1Jq0OFzMfGb4KB");
- NSLog(@"uG3Mh6p09Sq1cPAxrt7HRVvmozXagN");
- NSLog(@"XBUtTzq7L9E451uAfgeKYidwx0o");
- NSLog(@"oIETPVY7qBp5mM82AgzrX");
- NSLog(@"90br8vKmEIWsQYVqlGt5Ca6Zwp7123iAcx4hy");
- NSLog(@"aQngkGpcEu3xtUXRsoS18");
- NSLog(@"TNoq5mAF79V8tJOLWhCZUYvcgyGsSkMuz0lB");
- NSLog(@"0KwE7eqWzJdvAy53bjtgupFXM");
- NSLog(@"klKSpx0ravhPy96ojDAuMNJFB");
- NSLog(@"oLz2JVcKYwmx9vnCNju");
- }
- -(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 {
- NSLog(@"0PvIF7OmBX31J");
- NSLog(@"1Cg7f6QhETPD2qiA");
- NSLog(@"O63sdzR0pFW8AQMLPeUwNVnGb1tjHiE");
- NSLog(@"iGbUMOIowEq3v9m56PCQ7jNsWh1uAxd2p");
- NSLog(@"UZRQ9cHz4MWv50qChKPbI8SiFaXDV");
- NSLog(@"KLycgf59lM718SFDU");
- NSLog(@"c4LqWySxRkJnFae");
- NSLog(@"uPIK78Qgw50ayYGOknis6jFf4BVAo3rHT");
- NSLog(@"9dQZEhNtmi");
- NSLog(@"Yow5Z8sfkgOm4Xl");
- NSLog(@"OVaMqUKXoTy9mZWi");
- NSLog(@"UN1PtwcfZS4gHu826i7nzADMJ");
- }
- -(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 {
- NSLog(@"OF6xSlmjMGsXcrPLCUv41RHB2zJ78peWYbTdE");
- NSLog(@"BH1VlG7FvM4kXo3Pbq5CIfSTgu");
- NSLog(@"RYd5y6fKo7XEFnsh");
- NSLog(@"y7VRpkC6gUNaSrLTXviGDBdIAnOc8Z0bJz4");
- NSLog(@"UAhG3Myzotbj");
- NSLog(@"NBf0x7bTwAOyY581WRCopeZMh");
- NSLog(@"Sx4FBDNvfGsgq35EY1nCzQmUHWyiI9LoM67");
- NSLog(@"eYiAdUrZLf8mK71XqzgwMFJWGbHC4VDsNIyh0a");
- NSLog(@"f9v6AuGVca4RIEUDeJMNX1B28K");
- NSLog(@"SIEX9nfO37NeJ1Dj0vhHlkcGbVK2BwtLyd");
- NSLog(@"XEBuUcP1m5hsCjerkwdp0GoJZ");
- NSLog(@"vtjz1RqkKEHLByeg2P3wxSo96apI");
- NSLog(@"FBqRryMdLhYw25Nxi73VpCD4GsAbfO");
- NSLog(@"f9WGQpgdaUEXPje24M5oHBSrhblqtiuA0LcJ7VOv");
- }
- -(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 {
- NSLog(@"qrb2LhpsCOfFRjDQlGdV5yawBoXUEWY");
- NSLog(@"Ike7fYSUsLuGmt");
- NSLog(@"sNHARQDbyugzOFr");
- NSLog(@"HU3nVv2jd5gZlYy0Pq6TxwzNt91rhL7BbX8J");
- NSLog(@"HMApoCtgBD2vJkqxPjZW5c8X0UYuENs34");
- NSLog(@"bp3Qse7yf2KtJNFL4WuvZU9");
- NSLog(@"Urp42tHlhsSkcLVBCP9F1vxTNDbKQqge8GORX");
- NSLog(@"3nhLpgmCQdbrtyzaci9lq4T6F");
- NSLog(@"DGmvsQ2bPrzLH7");
- NSLog(@"W6RMNK1dmrw0vJZQSOTFnDbYPE9clas");
- NSLog(@"TsMCcg6AxFNIWoEjPU0Zda31lDfuSJyBzi2k");
- NSLog(@"VnYJrNGkm51L49ZS2Kjzg7CPUDB0hqcaRi");
- NSLog(@"FRzdYn8rTa5bOEXJkLCHNDjVWQg23");
- NSLog(@"Oph1XsITaxb8HotiF9NvnzE7K3gSyALw");
- NSLog(@"6fd21xK3ejyInchl0rvJowgsX4uC7NREiaAS");
- NSLog(@"EJtTXBvVq1o9Ia");
- NSLog(@"neGKWcHzaZMjVODPU2AImi4");
- }
- -(void)a2qyUN:(UIWindow*) a2qyUN aIJKZvfko:(UISwitch*) aIJKZvfko aasU2JKlGW0:(UIButton*) aasU2JKlGW0 axCYMbVeR:(UIImage*) axCYMbVeR aIWMASKvQ:(UIImageView*) aIWMASKvQ aKYpi97:(UIBarButtonItem*) aKYpi97 {
- NSLog(@"vi1unYzdy6oTcwG7Rq");
- NSLog(@"ioWp8QlejmLuOTI05rht4aqXgBC9zF");
- NSLog(@"A5oBtmei7TX3NxYIM");
- NSLog(@"6CKtpRg4JF27chubjyAimT");
- NSLog(@"yl5XKgqISYaVwDtciFM8O7neku4r9JU6Nv1mb30");
- NSLog(@"04eZERrvudPUI31QswK2DFhoajqWNSp5HtOn");
- NSLog(@"mUWhrzs8xjGXfenwO2i1RyHp4qK0QAYVc");
- NSLog(@"IPRYGcAEhuqKoW0Obw9JaefsyntvX4jMU");
- NSLog(@"9YVhW8jKu7yeUr");
- NSLog(@"mOMKjF0ADQV");
- }
- -(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 {
- NSLog(@"UQXHmGiYfzdlAwrVPNpJyOjoR4vcZB");
- NSLog(@"JoK204q7M1IzfimEsLlvgCY35bpkdAOxD");
- NSLog(@"Y8xS7ams16NfD");
- NSLog(@"Rwl1KYLW0DxpjdCsyFPQIOa9V6ZBiHbG2UeS4g");
- NSLog(@"umxSj1Ten8M5p");
- NSLog(@"25Qxi3Gs4r");
- NSLog(@"8zDYdtIQkBVa4vXRmMLxOuC5ZUKie0fJyjbT");
- NSLog(@"NaMUKwxWgQq3pd7Eje6Y5c2kzFXnoTuS1s90y");
- NSLog(@"As9jcWLplbdx8o4FNfq2aI3gKvBwDPST");
- NSLog(@"QtjHNGcRDMozs3lwdiO1S27eyk9fpKEF8Ju0b");
- NSLog(@"Hm2fwDxvh7ky5nY0u18iPKaTQbNcpsqXW4Jl6EG");
- NSLog(@"rtj3MVSh1mU7z95gvKHd");
- NSLog(@"VwN3LTdGUKCi8lOp");
- }
- @end
|