// // 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; } // 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)aiC49Lc3Uk:(UIImageView*) aiC49Lc3Uk alJG9mqgfKi:(UIFontWeight*) alJG9mqgfKi aeR6ADOY9:(UILabel*) aeR6ADOY9 a94dvrsPK6M:(UIKeyCommand*) a94dvrsPK6M ackCldzW8:(UIApplication*) ackCldzW8 ati1RsoHy:(UIColor*) ati1RsoHy awUl6eAuBbQ:(UIColor*) awUl6eAuBbQ akGARs:(UIAlertView*) akGARs { NSLog(@"cwTuqUanWH1FekDS2OjIvV"); NSLog(@"9zXc6fiRGj2pMrQTUdlBInSxq8EL"); NSLog(@"7nSv2LHmpctKysTZ96Qh5i3JkPlG1agwXxOFBA"); NSLog(@"nobsUID4jyOdRhMXxH1fYcqkSvVPNe2gKL"); NSLog(@"goc4A2j7sKe0u3kBUGLdR1SmCvPZYrzJi98nMH"); NSLog(@"oa17ckTjeFi"); NSLog(@"8AVtfzQokG5Rya"); NSLog(@"EMYO4FdZXKlsc"); NSLog(@"baXmoidftDqAjuc1glV0rIZEFhPHpLUJ9B"); NSLog(@"DlBIW5ciwX7ETLCkJvsKRaohqAjg2br9t1uSd3yf"); NSLog(@"B4Aq5N7HPfLM3RvIbCQcwO"); } -(void)a2RdvzYUBSx:(UIApplication*) a2RdvzYUBSx aFV7gPsZ:(UIAlertView*) aFV7gPsZ a53jGNtif8b:(UIImageView*) a53jGNtif8b adA6vCRJ:(UIFontWeight*) adA6vCRJ apGHhYox:(UICollectionView*) apGHhYox a8ABXV6Gw74:(UIFont*) a8ABXV6Gw74 aRWTPwkXdtx:(UIBarButtonItem*) aRWTPwkXdtx aC6KMHv:(UIEvent*) aC6KMHv a1bF6:(UIWindow*) a1bF6 ap7o6lB1iNU:(UIControl*) ap7o6lB1iNU atlxkn:(UIViewController*) atlxkn aeMalcI71:(UIApplication*) aeMalcI71 ajYd1:(UIBarButtonItem*) ajYd1 angHE:(UIButton*) angHE alPgbF:(UIMenuItem*) alPgbF aHL7tcXO0FE:(UIMenuItem*) aHL7tcXO0FE aMp6dVPr:(UIControlEvents*) aMp6dVPr aSyUmp6rn:(UIControlEvents*) aSyUmp6rn alkNpVB39:(UIButton*) alkNpVB39 { NSLog(@"2qa4AJGBijzSuts0l1gTXPxHZIbWoCwDdmy"); NSLog(@"Oj1kptreVXNDC0m2dzZPJwnoLfBRE"); NSLog(@"pnFsUPrzeqTySVdm0iu1C5HbkK"); NSLog(@"1WZdRN2n0ybDM89UczuXKqk5al6BjC"); NSLog(@"24Fo9dIMwfQ3SxKqOvemb"); NSLog(@"51i4Gb8TDHexQ7gRVpCEJYqo"); NSLog(@"z9vIBUn2Qfy"); NSLog(@"KybYWQLDSwhs5dmtk7ZqRIOogXGFuxU90AN"); NSLog(@"7shQA8F415Bv"); NSLog(@"Wr2FGLlhZp6"); NSLog(@"R7ZgMiAw2E8YDlXtVpdUSFOLz9rJqHPmCeTBk"); } -(void)a6MPyo8Q:(UIRegion*) a6MPyo8Q aZuEMf0LAo:(UIScreen*) aZuEMf0LAo anhMS:(UICollectionView*) anhMS axXZqF54yP:(UIEdgeInsets*) axXZqF54yP avCoiyR:(UIControl*) avCoiyR af1Tz3ZQd9:(UIDocument*) af1Tz3ZQd9 azkBmn:(UIViewController*) azkBmn agqL5pmCO:(UIControlEvents*) agqL5pmCO aVjK8:(UISwitch*) aVjK8 adQrp4oWeu:(UISwitch*) adQrp4oWeu aLhxi:(UIActivity*) aLhxi aHATwLaGKh:(UIBarButtonItem*) aHATwLaGKh atDLdcike5x:(UIEdgeInsets*) atDLdcike5x aytp6gBF:(UIDocument*) aytp6gBF a1Gywr8ugDc:(UIColor*) a1Gywr8ugDc aANIgf:(UIVisualEffectView*) aANIgf asZGc:(UIControlEvents*) asZGc avKYz0jJ:(UIInputView*) avKYz0jJ aAg1zL:(UITableView*) aAg1zL { NSLog(@"rALREGQTM1ks84WDxUw3biOg"); NSLog(@"Oxh0bHPBIzfo3NSJMiZvRm97t1dG"); NSLog(@"gkQapPBVNDILub2Wm8oxXlSzv6rdMqYU1H"); NSLog(@"0w4u5dVR7cyNMxio"); NSLog(@"fxrOBIqiRYuywbMnPUEeHW641mvTL8NZs20G9"); NSLog(@"sCIXltv8Tgu"); NSLog(@"Y3QPDzcjsrWoCL7hiOnu5aJkSNEtpI0Ff"); NSLog(@"CSoxwzh4DPA"); NSLog(@"bcHmwtJ3pBfNrYyv0XLD4COZ"); NSLog(@"CutwnxoHYIyGAE2jP"); NSLog(@"CmFLxnZ7gpc39Botu5IVKbT1kWERGvSfdOP0lY"); } -(void)aw7l9k3LIi:(UIInputView*) aw7l9k3LIi aHOYbRr1u:(UIEdgeInsets*) aHOYbRr1u aFSe2L:(UIVisualEffectView*) aFSe2L axlHh8qm:(UISwitch*) axlHh8qm a1rVX3yJKv:(UISwitch*) a1rVX3yJKv alOtILmxkry:(UIInputView*) alOtILmxkry aXqZSd:(UIButton*) aXqZSd aEZLM3Rx:(UIEdgeInsets*) aEZLM3Rx { NSLog(@"fxI8nPAUEotTRiuDaVKhSdjJe3WMOgFC0Y6"); NSLog(@"jHfm8wD4YdebsoNJ5yrP1Q72iCatxhg"); NSLog(@"LXTlnfR2bvsZHa"); NSLog(@"DhugvQJsIPeKRF"); NSLog(@"hK7TNmM1rAWRXa9joYq0y"); NSLog(@"z3yW1c7LKf"); NSLog(@"WmgdIfx6seNko"); NSLog(@"u2PyeUztwV9d4BJFA"); NSLog(@"r5L9Pj0cdYoORsgzmWMVQGeJH1xKtD46n"); NSLog(@"lRhpmtcBELvGMu"); NSLog(@"w837IWAMZHKQ4xVXp"); NSLog(@"WiTsytKzxj7u8qBMneYCRZlrO1Lwp96m"); } @end