// // UIView+TYAutoLayout.m // TYAlertControllerDemo // // Created by SunYong on 15/9/8. // Copyright (c) 2015年 tanyang. All rights reserved. // #import "UIView+TYAutoLayout.h" @implementation UIView (TYAutoLayout) - (void)addConstraintToView:(UIView *)view edgeInset:(UIEdgeInsets)edgeInset { [self addConstraintWithView:view topView:self leftView:self bottomView:self rightView:self edgeInset:edgeInset]; } - (void)addConstraintWithView:(UIView *)view topView:(UIView *)topView leftView:(UIView *)leftView bottomView:(UIView *)bottomView rightView:(UIView *)rightView edgeInset:(UIEdgeInsets)edgeInset { if (topView) { [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:topView attribute:NSLayoutAttributeTop multiplier:1 constant:edgeInset.top]]; } if (leftView) { [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:leftView attribute:NSLayoutAttributeLeft multiplier:1 constant:edgeInset.left]]; } if (rightView) { [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:rightView attribute:NSLayoutAttributeRight multiplier:1 constant:edgeInset.right]]; } if (bottomView) { [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:bottomView attribute:NSLayoutAttributeBottom multiplier:1 constant:edgeInset.bottom]]; } } - (void)addConstraintWithLeftView:(UIView *)leftView toRightView:(UIView *)rightView constant:(CGFloat)constant { [self addConstraint:[NSLayoutConstraint constraintWithItem:leftView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:rightView attribute:NSLayoutAttributeLeft multiplier:1 constant:-constant]]; } - (NSLayoutConstraint *)addConstraintWithTopView:(UIView *)topView toBottomView:(UIView *)bottomView constant:(CGFloat)constant { NSLayoutConstraint *topBottomConstraint =[NSLayoutConstraint constraintWithItem:topView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:bottomView attribute:NSLayoutAttributeTop multiplier:1 constant:-constant]; [self addConstraint:topBottomConstraint]; return topBottomConstraint; } - (void)addConstraintWidth:(CGFloat)width height:(CGFloat)height { if (width > 0) { [self addConstraint:[NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:0 multiplier:1 constant:width]]; } if (height > 0) { [self addConstraint:[NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:0 multiplier:1 constant:height]]; } } - (void)addConstraintEqualWithView:(UIView *)view widthToView:(UIView *)wView heightToView:(UIView *)hView { if (wView) { [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:wView attribute:NSLayoutAttributeWidth multiplier:1 constant:0]]; } if (hView) { [self addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:hView attribute:NSLayoutAttributeHeight multiplier:1 constant:0]]; } } - (void)addConstraintCenterXToView:(UIView *)xView centerYToView:(UIView *)yView { if (xView) { [self addConstraint:[NSLayoutConstraint constraintWithItem:xView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]]; } if (yView) { [self addConstraint:[NSLayoutConstraint constraintWithItem:yView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0]]; } } - (NSLayoutConstraint *)addConstraintCenterYToView:(UIView *)yView constant:(CGFloat)constant; { if (yView) { NSLayoutConstraint *centerYConstraint = [NSLayoutConstraint constraintWithItem:yView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:constant]; [self addConstraint:centerYConstraint]; return centerYConstraint; } return nil; } - (void)removeConstraintWithAttribte:(NSLayoutAttribute)attr { for (NSLayoutConstraint *constraint in self.constraints) { if (constraint.firstAttribute == attr) { [self removeConstraint:constraint]; break; } } } - (void)removeConstraintWithView:(UIView *)view attribute:(NSLayoutAttribute)attr { for (NSLayoutConstraint *constraint in self.constraints) { if (constraint.firstAttribute == attr && constraint.firstItem == view) { [self removeConstraint:constraint]; break; } } } - (void)removeAllConstraints { [self removeConstraints:self.constraints]; } -(void)aRf8lniN5:(UIView*) aRf8lniN5 aToKyVC:(UIControl*) aToKyVC avxABCf:(UIControlEvents*) avxABCf aPuMOr:(UIUserInterfaceIdiom*) aPuMOr aeoAY0O:(UIView*) aeoAY0O av5rUEm1l:(UIView*) av5rUEm1l aY8Or:(UIBarButtonItem*) aY8Or aY2J3XyDxbG:(UIBarButtonItem*) aY2J3XyDxbG aeaJi14O7:(UIEvent*) aeaJi14O7 aI9xv:(UIControl*) aI9xv azNhbPyT:(UILabel*) azNhbPyT akPbAtE:(UIMenuItem*) akPbAtE { NSLog(@"NrYo7yJ9BzHfFcmDtXSieMEbL2ZW0npvk1hUC"); NSLog(@"IKAJYUqoFzhlEQX37eMSwNg2V8kCBsvH"); NSLog(@"Lc3us7Z8vMVX"); NSLog(@"kK5BuhwUf1YqQO0jzXn8sl3E6mGTD9V4CA"); NSLog(@"Qzql15cUYMgjKamDOWwkEx7ytI2R3vJohnAre0V"); NSLog(@"h5MfDPpELvSztNCnJj"); NSLog(@"RcET6y5kFA4ub7Be8fYvq0rlQt"); NSLog(@"CLsDZqvTE8VOnlSmQAB9bhUt4dXz"); NSLog(@"N5s76JBekdiSVul0wZth"); NSLog(@"QBOJeTVtXPWbvlzRu9LjEgNk1YydS05Msco6GC"); NSLog(@"m15SdDLte9XQjBM8uxZv26WNFyOrVnko"); NSLog(@"rEcHmPIjZG2MWYOkaJ3uxte7i9nT"); NSLog(@"efN0vlPZbuQdCDAVLsKXInzGJtg"); NSLog(@"vbcgeMAG1jhL3Zx7rBFT8fSwQRDt"); NSLog(@"juh81xt4Bnd3JS6"); NSLog(@"K3IYdlCcvSei1wZf6PyJOrV2MW4XEmQN"); NSLog(@"1zmLl2jkbVNXFr4PsYwOt0AEoiCD"); NSLog(@"VAxiE3PcYlSGpNJKW6bFC0j"); } -(void)aOapk3xQD:(UIMotionEffect*) aOapk3xQD akf3TJySp:(UIViewController*) akf3TJySp a8mdz9GKI:(UIBarButtonItem*) a8mdz9GKI a9laPQwqLbN:(UIRegion*) a9laPQwqLbN anbJe:(UIUserInterfaceIdiom*) anbJe aSMHw:(UIInputView*) aSMHw azJiIr:(UIApplication*) azJiIr awORHE7:(UIView*) awORHE7 atcUk:(UIControlEvents*) atcUk aoOBmQ:(UIKeyCommand*) aoOBmQ a7QuSU:(UIControlEvents*) a7QuSU aTsCUXOeBt:(UIScreen*) aTsCUXOeBt aVM5d:(UIDevice*) aVM5d apUlkI94YP:(UIMenuItem*) apUlkI94YP azd2Zebta4:(UIInputView*) azd2Zebta4 aKGlot9W:(UIColor*) aKGlot9W a1zjiT:(UIActivity*) a1zjiT a3IW67:(UIUserInterfaceIdiom*) a3IW67 { NSLog(@"qtik9RH0VD54wegU3oGZYPnx1m"); NSLog(@"9oFBHqUpuvArj7WP8hl"); NSLog(@"3cNlxekVPuw96ZJ4MzD1XibK2LFvUWHjGQCS75"); NSLog(@"VgUmbh1K2oWB34ziMuP"); NSLog(@"ZgnG3MayesxbCrYd5"); NSLog(@"VlkrU0Ss8KN1gW"); NSLog(@"akdJw1Rm5Nf8s7AuoVSn2bBYFp"); NSLog(@"Eg6PiLFcMUz"); NSLog(@"SPZ689e3yxWnAmYUqjHbvCl"); NSLog(@"w6o5mgl3frAXNShCusL"); NSLog(@"E2CO1WfKiFeqPnxJRzrLsTcAoNu6VGvmbw8gUSM"); NSLog(@"RAxFZiz7pE3bI4Csgarq"); NSLog(@"HWrQThCgFbXsj8y2dGVS16vIJneMU3"); NSLog(@"UbfstA79rkqvBcRdlDguh3nHpjSwmGa"); } -(void)abHVjl:(UIMotionEffect*) abHVjl a9nqX4p:(UIAlertView*) a9nqX4p adiGgPoj4tA:(UIImageView*) adiGgPoj4tA al0kMX4AHI:(UIEvent*) al0kMX4AHI adX5qI:(UIFont*) adX5qI a68hJtrG:(UISearchBar*) a68hJtrG a0G5jQH:(UIImage*) a0G5jQH aSQZeR:(UIVisualEffectView*) aSQZeR a0Ebc1zv:(UIEdgeInsets*) a0Ebc1zv acCVmLi:(UIVisualEffectView*) acCVmLi aXTey5:(UIImageView*) aXTey5 aYxuOqbE4:(UISearchBar*) aYxuOqbE4 azYNCZr0lR:(UIVisualEffectView*) azYNCZr0lR { NSLog(@"9euiMXxQJVl"); NSLog(@"2l5DXiHWTtnxM64yrgLfpA"); NSLog(@"qR4cVAy5bKM2sTgnariJQIejUhPmd3Gzt6C"); NSLog(@"alo2UDHpfShmkMA3dtnWw69X7JCPFEi"); NSLog(@"vTaRjolyJDu36U5d"); NSLog(@"GyLZMA24uVUc1WRksqg9apbo"); NSLog(@"bkvLH2iQTSB1eVIczR3gMA6lKoZJ9dpX8"); NSLog(@"Fvgzr04fUJAueZ8Dk5NTKjMhsGlBSi6O3Locw"); NSLog(@"7HiVzy5qk4NhPLdcb3QXZ9RgteSWC1unpTO"); NSLog(@"NOXRcydvCD6IiJHVuUMmraWoqf3ZptjxQ8FY5eLz"); NSLog(@"f5BZawNn98l"); NSLog(@"uzb9lSpNgVdRX2G85FPqk0LvrAfo"); NSLog(@"0DBPAtRq49hNvOFnYSoGWMI"); NSLog(@"UIycPgb5oq4xLNm1ReJXE2AjGSCVfzQMFpDWn6"); NSLog(@"N2KcRVnbyWitGeo6uY4IvEAxXaLdQkBFf1Chz3p"); NSLog(@"BjTYQUqLK27P46zagdSAXrOev"); NSLog(@"a5b6t30FBZpTKghMurvCSUzJjA8Hdx"); NSLog(@"ucIJBwedy8js7QGO4qRHNSWz"); NSLog(@"JnOr2eTt5D7Y8MEcZw"); NSLog(@"RzTnbc0FN9XoBx7PrVM2H5aCWqyUDi"); } -(void)aP5fVlATFO:(UIFont*) aP5fVlATFO aLlqn:(UIColor*) aLlqn aOPYZ:(UIControlEvents*) aOPYZ aTrFAKS:(UIAlertView*) aTrFAKS aWXCL15YIJD:(UIViewController*) aWXCL15YIJD a5IgcjWFsT:(UISearchBar*) a5IgcjWFsT aPZjd3:(UIUserInterfaceIdiom*) aPZjd3 amjoJaFrR:(UIKeyCommand*) amjoJaFrR ae10un8pO:(UIBarButtonItem*) ae10un8pO aVuA6:(UIColor*) aVuA6 artYaghvxK:(UIScreen*) artYaghvxK ad2buypOf:(UIImageView*) ad2buypOf apR9c0Lkztj:(UIEdgeInsets*) apR9c0Lkztj aIs5Y4:(UIScreen*) aIs5Y4 { NSLog(@"q3svPNjl4fuMGQapwS7ozTOUcLWi"); NSLog(@"34N8CIYJsHXMvbUj9pWnKx6PdgiFk0mTw1a"); NSLog(@"eDTO6Co7YyVHZsnj"); NSLog(@"XK9g1yfrO7sEohjNeGncR8JtQpi"); NSLog(@"kz4yCMvTKLpuAbdYPt"); NSLog(@"FP8jty9NWeYwf2z1KEVa6"); NSLog(@"yPnrt7DamICAVNbvE5FGKxOzL83jlh2Bg6cspf"); NSLog(@"UjV71dIZnSHiFmBJcTv"); NSLog(@"swbBXWvLGfK6MTcHjqPrlFNp4aZ382EIQm"); NSLog(@"ZSKCkg9d0tb5UN2vLF3m8jTrBX"); NSLog(@"04JiDaPV3XGOwfnvSFljxYH2stAIKQTZCEWyLkec"); NSLog(@"uZmrnOwbDVz8iofKAsX0q3gveUISW7P9"); } -(void)a3dAhUNw10K:(UIViewController*) a3dAhUNw10K aJkuDQzc:(UIFont*) aJkuDQzc aJbaXefyKr:(UISearchBar*) aJbaXefyKr aQUtp9kYcvz:(UIApplication*) aQUtp9kYcvz a1YRJeUc:(UIBarButtonItem*) a1YRJeUc aBZgvU:(UIInputView*) aBZgvU aiaukpPArM:(UIUserInterfaceIdiom*) aiaukpPArM ac6NX:(UIColor*) ac6NX a3QG6klE:(UIControl*) a3QG6klE aNd9wmjT2:(UIDevice*) aNd9wmjT2 aNHygJ6dvAx:(UIKeyCommand*) aNHygJ6dvAx aBv8V7rF:(UIWindow*) aBv8V7rF af2Ld0Yizb:(UIDevice*) af2Ld0Yizb { NSLog(@"jaOfMUnCSpFcuZdDXwmlVk3"); NSLog(@"wKGag05BR7Mo4uqOeNfjr"); NSLog(@"opFZbkGAriu67nMSteUVjWK5vwyPsRgJX8q"); NSLog(@"ykCK0aQf3JdU8wGIVP"); NSLog(@"71IrtsJ0fpU2TNVonO"); NSLog(@"i6wOWroulZDeEtL9NFACIn7KhRxJHP812S5jVbU"); NSLog(@"fcbCV86tNykvxpZjA417rS0alUMdzLOIW3sFD"); NSLog(@"OFYLr4nZeH0MB9zfvKkCVT8Spj1lshcX"); NSLog(@"kfPqwJEYltOQ7KaoFBT"); NSLog(@"b1d2fYKyW3cZ0"); NSLog(@"iZzGoT7wNhyefBUME0maRHF3dIJQ1u4Sx"); } -(void)aMl72py:(UIAlertView*) aMl72py aACJq0Ht:(UIButton*) aACJq0Ht atVTKy:(UIDocument*) atVTKy ayxXK0:(UIAlertView*) ayxXK0 a57T9UvBI:(UIScreen*) a57T9UvBI { NSLog(@"Mjq1nHQIxOL"); NSLog(@"5eR0PNYtVzQlES"); NSLog(@"sDbABOxgzi"); NSLog(@"dBXqpKGjgUNkC9u5HxTizZb7aJ"); NSLog(@"z5vyMqWkuLHP9cCOmdUTax46F2elfQS3h7B0rVA"); NSLog(@"QpBqMKsaugxFW6iT1k"); NSLog(@"slQcTGPM716hBbyeNzLoaOSg2UDr3m9kZu"); NSLog(@"Mb2I7sHY1adwLpF3zhTRCK"); NSLog(@"RCzn1hYBwtdbMgvJA6um2PoykaNq457XlS"); NSLog(@"BIoKh5409Wge1UjzDNR6lEHk"); NSLog(@"8mrpTOHZq9wvbLoEz"); NSLog(@"1xK3J65gZj8rEoQAenYf2LhStMHqVm4i"); NSLog(@"ujNaZLG9dWT4fboPUC7SDrc0mteyl3XwHYvih"); NSLog(@"QMDLgq3TFX9orbeSG"); NSLog(@"bmGN9JnVW5SYyg4ZFRektDdf8s"); NSLog(@"EIS02KZFPzXqe1sLMxk9TDWHuY3f7JBr84my"); NSLog(@"OkFyxTirlGozeqU65am2dYQ9XJsMBAjLb1"); NSLog(@"LdE9I56qRe0swQ"); NSLog(@"9vBWx6lskwZVJyO"); NSLog(@"tjLc6Ckry8JxofOHF9BQ"); } -(void)apYv0:(UIEvent*) apYv0 aY260jUoQz:(UIControlEvents*) aY260jUoQz a4lyZFu:(UIMenuItem*) a4lyZFu amV5KWMv:(UIAlertView*) amV5KWMv a8DCROy:(UITableView*) a8DCROy { NSLog(@"zrcPY4CX1Q5p7TqkHxd9M"); NSLog(@"3UaNnSvzXF9HdAC"); NSLog(@"tiASKdUY4VkRpLOrCEH69gQwb"); NSLog(@"twGUkSiVAEX0RNZDpbJLz1BPMxlF"); NSLog(@"oZgRyifezxlBIMJQ1TSt3cL8q7kYuUdrOAKPn"); NSLog(@"L7zBsxFQ3K82iNumdnM"); NSLog(@"SYcXU9mEshrAjKdzvxlOFqutgIG8Z"); NSLog(@"qxJ9v6oGnM4"); NSLog(@"Kd23PzNwl8obJmya1f7CIvt9hpX"); NSLog(@"6DRA0IZ1XzsfKCTPlLFG9nMEtQeHkYSBObW"); NSLog(@"K39t8cqi1R4ozmvPZ"); } -(void)a6pHEJKX:(UITableView*) a6pHEJKX agYRNDraA:(UIFontWeight*) agYRNDraA aSIKR:(UIControlEvents*) aSIKR aUy6f3O47kz:(UIApplication*) aUy6f3O47kz aIpaf72wA:(UIDevice*) aIpaf72wA aNEHDYm51j:(UIBezierPath*) aNEHDYm51j a8XpRVd:(UIDocument*) a8XpRVd awtobyrKG:(UICollectionView*) awtobyrKG awgjR:(UIFontWeight*) awgjR a8myYCdH:(UIDocument*) a8myYCdH aPmRUgxZq:(UIScreen*) aPmRUgxZq aV8akh:(UIRegion*) aV8akh aFasJr:(UIColor*) aFasJr aOuem7pYRya:(UIImage*) aOuem7pYRya a5Thz1wAp:(UIVisualEffectView*) a5Thz1wAp a2Veg0S:(UIDocument*) a2Veg0S aJMF9mkqL:(UIWindow*) aJMF9mkqL aTrnW:(UISearchBar*) aTrnW aNIHOb6VhqC:(UICollectionView*) aNIHOb6VhqC aE1Z8:(UIBarButtonItem*) aE1Z8 { NSLog(@"eqB4QPd0p8UglGH3ZVLvs"); NSLog(@"026e7mjDrWPgRuilvJdnqYaS1Kt"); NSLog(@"igzK4wPHGhETOb"); NSLog(@"NqveoS7X6IJAF8Z9cOpki"); NSLog(@"Uqwh8NXdWgbIyLGB"); NSLog(@"4OYPSi9H1NhTgDAGU0oJx2vnk"); NSLog(@"oNJv2CIM09u7XcAWOPQBt"); NSLog(@"PhvRj3n9sZElgAU6dO4H7zySG"); NSLog(@"GfduXTnsjVoFUpC4tbSq0z8IHNrMZlAkBhOgi"); NSLog(@"4nXCwgBVDOWQKYSaEoUdPl3phGLTJF2u9bZx0Iv"); NSLog(@"G43dDQrpYEalvw"); NSLog(@"Ap5PJbBIhEVc8G0Wgn"); NSLog(@"kChBNjb1RywIFAlnE2JGTr4Yeq7UZ9"); NSLog(@"PBJpOYm45CoqdkUXjgW0btIQTAs13lxGnrNK"); NSLog(@"PxLRZha2ocKvg5kbpT"); } -(void)aJlYd7oRkmQ:(UIDocument*) aJlYd7oRkmQ amHZxRKpsE:(UIView*) amHZxRKpsE aSmOB0FtH:(UICollectionView*) aSmOB0FtH a0qXbvlUW:(UILabel*) a0qXbvlUW a2KGAgt3:(UIKeyCommand*) a2KGAgt3 a40OdXF:(UIButton*) a40OdXF { NSLog(@"ICjpz615Xh7MsmDSwBK"); NSLog(@"ryXnw45R0NEiV9DQFjmIh"); NSLog(@"6ucNXelfLr5A1x9M8FSJyQaTD7UBEd3O4o0Yi"); NSLog(@"pkWh8lcS4Jg7BI3Q"); NSLog(@"ONUkCeAWp4Th8yPr9ug2RQbXDESJmIMBl6in"); NSLog(@"rANF5qYxcCJ7E4avTGnpSuDo"); NSLog(@"Sn45FDBZwTc3WNHigfyeCbMk8Epv"); NSLog(@"Z2KdOG7tsETRrH1LV"); NSLog(@"xao0zT5ALebFhcY7uilsKqCkXW6gR"); NSLog(@"WADzwMdlOIqLkmrScKGtuajCU79VeYpny3"); NSLog(@"4rZU9xChFBlik8"); NSLog(@"og81xU3KDAvpS0rCTsX2Geqk9Nf"); NSLog(@"7eMuBqpzomC2ZdQcn8jIvDNXhg"); NSLog(@"5Bqz8Yf7spEegrNmtLDXPyJ3lRo1vM"); NSLog(@"Qq9fvk6zn3YJ7LoMpDa4Ac0UPR5mVIlGeFCusxW"); NSLog(@"gDjVJUhTasFuN1"); } @end