-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathViewController.m
53 lines (41 loc) · 1.31 KB
/
ViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// ViewController.m
// CDDDemo
//
// Created by gao feng on 16/2/3.
// Copyright © 2016年 gao feng. All rights reserved.
//
#import "ViewController.h"
#import <Masonry/Masonry.h>
#import "CDDDemoController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = [UIColor whiteColor];
int btnWidth = 100;
int btnHeight = 100;
UIButton* btn = UIButton.new;
[btn setTitle:@"Demo" forState:UIControlStateNormal];
[btn setBackgroundColor:[UIColor purpleColor]];
[btn addTarget:self action:@selector(gotoDemoController) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
[btn makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.view);
make.centerY.equalTo(self.view);
make.width.equalTo(btnWidth);
make.height.equalTo(btnHeight);
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)gotoDemoController
{
CDDDemoController* ctrl = [CDDDemoController new];
[self.navigationController pushViewController:ctrl animated:true];
}
@end