// // MASExampleConstantsView.m // Masonry // // Created by Jonas Budelmann on 21/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASExampleConstantsView.h" @implementation MASExampleConstantsView - (id)init { self = [super init]; if (!self) return nil; UIView *purpleView = UIView.new; purpleView.backgroundColor = UIColor.purpleColor; purpleView.layer.borderColor = UIColor.blackColor.CGColor; purpleView.layer.borderWidth = 2; [self addSubview:purpleView]; UIView *orangeView = UIView.new; orangeView.backgroundColor = UIColor.orangeColor; orangeView.layer.borderColor = UIColor.blackColor.CGColor; orangeView.layer.borderWidth = 2; [self addSubview:orangeView]; //example of using constants [purpleView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(@20); make.left.equalTo(@20); make.bottom.equalTo(@-20); make.right.equalTo(@-20); }]; // auto-boxing macros allow you to simply use scalars and structs, they will be wrapped automatically [orangeView mas_makeConstraints:^(MASConstraintMaker *make) { make.center.equalTo(CGPointMake(0, 50)); make.size.equalTo(CGSizeMake(200, 100)); }]; return self; } @end