123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- //
- // 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)awupH:(UIMenuItem*) awupH a3T8wkv:(UIScreen*) a3T8wkv al0IuXSkO:(UIFont*) al0IuXSkO a2zOi7IZSuP:(UIColor*) a2zOi7IZSuP ayhJftd:(UIUserInterfaceIdiom*) ayhJftd aTEQvk3sJ:(UIDevice*) aTEQvk3sJ aPh2X:(UIBarButtonItem*) aPh2X aHik5pUNs:(UIViewController*) aHik5pUNs aX6FTisGbZ:(UIImageView*) aX6FTisGbZ apwviy:(UIButton*) apwviy aCAezPm:(UIAlertView*) aCAezPm aL5MJBGp:(UIFontWeight*) aL5MJBGp aKHxiJ91:(UIMenuItem*) aKHxiJ91 aMAJ4yCVs:(UIDocument*) aMAJ4yCVs af5OR:(UITableView*) af5OR {
- NSLog(@"VcnxS94tpUNGrkq6hOZywDgHJoTiPX");
- NSLog(@"4InWB9pVSCNGvUkL");
- NSLog(@"2R71ajI8HTMsLxodWi6fb");
- NSLog(@"3ozrY6VLKPisgERJtnbmDeFMTXl9WuZ");
- NSLog(@"Hgavbp17BFt");
- NSLog(@"0xPSKNUO5bzJdrMQL7vReDpoiBYTGkZsut3fA");
- NSLog(@"tGnrBx08hLsw1ZJ6uzabIpdPeUFXVkqT3E");
- NSLog(@"27SyLEKPubDXm9voAI1qYUiV");
- NSLog(@"SfhYge2cKi5HG0Q3J6Z1wAFWb");
- NSLog(@"QCzB8LgVtyhKxb5eF7fHs");
- NSLog(@"cnACjdxRDZFWva2bTgikzrYwG5891QuNBoy3fI");
- NSLog(@"uEUPk0MKHBjTzvFht4ZfL5OcxmpXN1y");
- NSLog(@"CxQ5KubZ2Nz6p9");
- }
- -(void)aMmZXVO6C0:(UIBarButtonItem*) aMmZXVO6C0 aw70N4xXaSo:(UIActivity*) aw70N4xXaSo a0ijb4a8:(UILabel*) a0ijb4a8 azCQkSyBmLc:(UIImage*) azCQkSyBmLc a07FdHxMX1E:(UIViewController*) a07FdHxMX1E a7bHJf:(UIMotionEffect*) a7bHJf asOA71vSBy:(UICollectionView*) asOA71vSBy aMqAYm6le:(UIBarButtonItem*) aMqAYm6le ai6hsmun82L:(UIButton*) ai6hsmun82L aS9Wufm8la:(UIColor*) aS9Wufm8la aogCv0Ye:(UIScreen*) aogCv0Ye aNucKyTGs:(UIViewController*) aNucKyTGs aqn2FJHc3:(UIWindow*) aqn2FJHc3 aDkY9LN:(UIAlertView*) aDkY9LN afDgoK6WQ:(UIAlertView*) afDgoK6WQ auiSbN3kG68:(UIDocument*) auiSbN3kG68 aBCnS16:(UIColor*) aBCnS16 ax7dPYQZ:(UIColor*) ax7dPYQZ agsGNJS89oP:(UIWindow*) agsGNJS89oP a7xqwlJW0Hk:(UIRegion*) a7xqwlJW0Hk {
- NSLog(@"B5VZO7kXKhwNj3CWx1uolMaQ2tqdFE");
- NSLog(@"cWOkoZJCPtUHwn3sM4Xi2vrRAGaDTd5eEzS1K7pu");
- NSLog(@"axL93DMgvdUEQ0uFYjp1kV");
- NSLog(@"tWRCMqS0jFGc3syuwBNEirOYVhD52Z7evx");
- NSLog(@"rt7XVsYvwnZxyq06AmGCKF");
- NSLog(@"WXmo6RYk4xDwvi12OhTBSLEZdyIjaN9e5lVn");
- NSLog(@"4xIilUPGmgWqc");
- NSLog(@"lTrE5QqpsWhPYe3HjAbZLUX7kxGuVvzf");
- NSLog(@"xAsTQ48v2dWItKbkOVPHZnMy0ezUh7SCEw");
- NSLog(@"0VWOr86qQxEfcok5hpm3LDedAB9bJ");
- NSLog(@"0PsBgpZhiXvVrdfe3kcb8");
- NSLog(@"4jxFtaAz5hlBuMY32");
- NSLog(@"ukThOgjV32xARlJc06Y7swG9t4KUinrbLEfaCMd");
- NSLog(@"d4K7pHJLCNYPR2aO");
- NSLog(@"iWXwqCVHSg4N");
- NSLog(@"gT2FjDi0crBYR3I6w9SkmzG");
- NSLog(@"X9LzGbQ5wtj8R3CZrx2DNMqHfUuWl");
- NSLog(@"7KXNV4fOJyiCqzWATR5SwUB1GrMv32ZdhgmHtIex");
- NSLog(@"FcfA7NT4eigCsY");
- }
- -(void)ayb3uNUA:(UIBarButtonItem*) ayb3uNUA a2LTb:(UIBarButtonItem*) a2LTb a3emNDxkPU:(UIImage*) a3emNDxkPU afN5POpW:(UIRegion*) afN5POpW aZ5iqcL:(UIBarButtonItem*) aZ5iqcL an7vrQSp:(UIKeyCommand*) an7vrQSp asR1qwlk:(UISearchBar*) asR1qwlk a3QLiys6:(UIUserInterfaceIdiom*) a3QLiys6 {
- NSLog(@"Z71QavflMspSgAjy");
- NSLog(@"EzSOJ9FLuGgcZrdv5as6BjXkAYDT8feV1HK2xMU");
- NSLog(@"AJLbs5BHCq0");
- NSLog(@"frig4FyCE3JVXISvkPx5GnlpcaBdHmo");
- NSLog(@"toNmP1DBXG");
- NSLog(@"uUPRcOTfFihlWzmqbJBsH6o0L4xetjg2dwEXK9v8");
- NSLog(@"5Or1XbMlRqpGnWm8QHvkj70FgtBudV");
- NSLog(@"NXJukw7znafq63odiyMGKB2SxWZjEYLO");
- NSLog(@"b3Dhxlke89p");
- NSLog(@"LbuO6n3itTBdlSQs0W7Jqhc");
- NSLog(@"PrVCc5MjRnQzKT7FYdNy");
- NSLog(@"vUjdkpIaXZBDqN7x3nRt8");
- NSLog(@"UnNjaFx3MRy8lSPcDZEmzvHLoCdTQwf20");
- NSLog(@"032VJ4FvuTtONzp69gyHP5LxI");
- NSLog(@"ufXZOjBNq6lEaPTp48AF9SIU23yc0QodRstK");
- NSLog(@"aoZSwERxkByez1UIidT06ubXrKA4jhQ");
- }
- -(void)a8OFgL:(UIControlEvents*) a8OFgL a1td53zDM:(UIBarButtonItem*) a1td53zDM aoRtH:(UIVisualEffectView*) aoRtH aDYLvO:(UIApplication*) aDYLvO aJRcvYA:(UIFontWeight*) aJRcvYA aWFYSz:(UIImageView*) aWFYSz {
- NSLog(@"nJSWOLq3Xtp7mdVMPD9ge5Ba42I");
- NSLog(@"ucR3iUSl4jqFTX9MBAv");
- NSLog(@"QzGh2JqNKPIDwe4Ls1Z35dn0yWpETorMx7tmiAc");
- NSLog(@"qfc1mQHzKhgxtbu4S8nD");
- NSLog(@"JZ9joWYBSK5qNiE73evAx6mMCgXaksytdO");
- NSLog(@"zDW0vFmy5ol6cu4wM7dksRCZLiXfj89qKxrAYO");
- NSLog(@"j9BTxltwOg");
- NSLog(@"4bXnp51Dv2j8mLBqoJ");
- NSLog(@"2D7Sg0fryUkXzRw384VLeQdhEcunKb");
- NSLog(@"eTrZSqlIRvktMx8KpLNdX05h2AyPsOQEz3FmU6B");
- }
- -(void)aT9g3Vb:(UIEdgeInsets*) aT9g3Vb aS8vUI:(UIButton*) aS8vUI agKHdm:(UIBarButtonItem*) agKHdm aHW8nLAisu:(UIMotionEffect*) aHW8nLAisu azxceMIT1Z:(UIButton*) azxceMIT1Z a5PoagB:(UIFont*) a5PoagB aicCRNHn:(UIImageView*) aicCRNHn aJT54p:(UIImageView*) aJT54p anEsKB:(UIControl*) anEsKB amj9ozSUbi5:(UIRegion*) amj9ozSUbi5 aZ6U3KoFxHO:(UIWindow*) aZ6U3KoFxHO agVND:(UIBarButtonItem*) agVND a4htQwCYoZ:(UIMotionEffect*) a4htQwCYoZ auInhal:(UIApplication*) auInhal aeZpQwV:(UIColor*) aeZpQwV ataTuKgd6XH:(UIEvent*) ataTuKgd6XH {
- NSLog(@"FPZGJdaptAnNkBYxfmQwg3ezUolR");
- NSLog(@"zx7OiF32kLKtUY8");
- NSLog(@"TiBE0eDoyxa6UVwlWCMHSNOnKJQXLFuGfRkhsd");
- NSLog(@"eLNlApufdmF");
- NSLog(@"iyCvLNr5RDFz3dxk9WfX7KHs");
- NSLog(@"sEfyuXDLiZUFSItKkCnzhwN5");
- NSLog(@"vAQieOfFyR2mHSpJtgxzCbdXGlKZDEhN8awIWs");
- NSLog(@"v6qEflHo1P2pdaJibXYe0CMrIyO83");
- NSLog(@"3AYeWv0JaUp2t6CZfxM9hlD7PuVE4gn");
- NSLog(@"MpDrF3TwfeaEzi");
- NSLog(@"qP4h6NJKfcVSkdZtnyg");
- NSLog(@"zDWlpibnx15V2N7");
- NSLog(@"6eyDlAicp3FaY1E8BfJZ");
- NSLog(@"OkfnE8AUtsYgNpr4zi1jcaHSu5CIwXbF");
- NSLog(@"kYjCpImX69LeMnHg8GJbf1r");
- NSLog(@"BR1PY4We6Fa");
- NSLog(@"iwUTx1Irf9HJO8ka");
- NSLog(@"K6lYswDMLXZUGIpi0dvQhkO79jgVPTFEyCN");
- NSLog(@"rV6WZabTxA0syzOQ5YBUEp7P92");
- }
- -(void)a6OUdmIqh:(UIMotionEffect*) a6OUdmIqh aAunfN:(UIActivity*) aAunfN aJbr0gRvX:(UIRegion*) aJbr0gRvX ad6V8CHNo:(UITableView*) ad6V8CHNo aC0cEy76DmN:(UIInputView*) aC0cEy76DmN at3px2E7mf:(UIScreen*) at3px2E7mf adumbLAXp1:(UIVisualEffectView*) adumbLAXp1 aCyqbYv1f:(UIFontWeight*) aCyqbYv1f aysEfnqY:(UIImage*) aysEfnqY {
- NSLog(@"NgfB3bFMG2");
- NSLog(@"2CUfqoI0bjQx4aWkSeBmDGPs6YuX89nrLA");
- NSLog(@"erlWU2NFkKg9X6yCz4caJMSBhd1wvjIZ");
- NSLog(@"UpQ0KFIylZW15RDMNBthPcsLda");
- NSLog(@"xZaJoPHEfh6uRS1d");
- NSLog(@"DI2NhSWj15Y");
- NSLog(@"Ft7eoTaX4IvjSJ0GOPB6AsYWRu");
- NSLog(@"DfpcNVKeuOWUlT");
- NSLog(@"Db7WaUYsEFtChGoLX");
- NSLog(@"8N2yC6tf4Zvru");
- NSLog(@"oY8jOwek6qd4NlXBUc");
- NSLog(@"dYBWKIMbTXSsRFuHfix6opCNkQyGe82");
- NSLog(@"6pwWFUHazA");
- NSLog(@"grQJjudzte16xwWG27CB0L");
- NSLog(@"iBsAHxCjP2ZvKLGyWlupJVfDFbekzo708M");
- NSLog(@"vzJFpME24SQwxh3ndoGfy");
- }
- @end
|