arkilis
1/30/2016 - 7:23 AM

example1UsingMas_topLayoutGuide_v1.m

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    UIView *sv= self.view;
    UIView *view1= [[UIView alloc] init];
    [sv addSubview:view1];
    view1.backgroundColor= [UIColor colorWithRed:0 green:0 blue:0 alpha:1.0];
    [view1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_topLayoutGuide);
        make.left.equalTo(sv).with.offset(20);
        make.right.equalTo(sv).with.offset(-20);
        make.height.equalTo(sv.mas_height).with.multipliedBy(0.5);
    }];
}