// 链式语法的基本操作
#import "RootViewController.h"
#import "Masonry.h"
@interface RootViewController ()
@end
@implementation RootViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[_imageMusic mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.viewBottom).with.offset(10);
make.left.equalTo(self.viewBottom).with.offset(20);
make.bottom.equalTo(self.viewBottom).with.offset(-10);
make.width.mas_equalTo(40);
make.height.mas_equalTo(40);
_imageMusic.layer.cornerRadius = 20.0f;
_imageMusic.clipsToBounds = YES;
}];
self.labelMusic = [[UILabel alloc] init];
// self.labelMusic.backgroundColor = [UIColor yellowColor];
self.labelMusic.textAlignment = NSTextAlignmentCenter;
self.labelMusic.textColor = [UIColor whiteColor];
[self.viewBottom addSubview:_labelMusic];
[_labelMusic mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(_imageMusic.mas_top).with.offset(0);
make.left.equalTo(_imageMusic.mas_right).with.offset(15);
make.right.equalTo(self.viewBottom).with.offset(-80);
make.height.mas_equalTo(40);
}];
self.buttPlay = [UIButton buttonWithType:UIButtonTypeCustom];
[self.buttPlay setImage:[UIImage imageNamed:@"iconfont-bofang"] forState:UIControlStateNormal];
// 增加butt 点击事件
[self.buttPlay addTarget:self action:@selector(clickPlayMusic:) forControlEvents:UIControlEventTouchUpInside];
[self.viewBottom addSubview:_buttPlay];
[_buttPlay mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(_imageMusic.mas_top).with.offset(0);
make.left.equalTo(_labelMusic.mas_right).with.offset(10);
make.right.equalTo(self.viewBottom.mas_right).with.offset(-20);
make.height.mas_equalTo(40);
}];