9.5 AutoLayout约束的优先级

9.5 AutoLayout约束的优先级

#import "ViewController.h"

@interface ViewController ()

@property (weak, nonatomic) IBOutlet UIView *purpleView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    //点击空白 让紫色view消失
    [self.purpleView removeFromSuperview];
    
    [UIView animateWithDuration:2.0 animations:^{
       
        [self.view layoutIfNeeded];
    }];
}
@end
9.5 AutoLayout约束的优先级_第1张图片
AutoLayout约束的优先级.png

9.5 AutoLayout约束的优先级_第2张图片
AutoLayout约束的优先级2.png

你可能感兴趣的:(9.5 AutoLayout约束的优先级)