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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
// DiscussMainViewController.m
// Lighting
//
// Created by 曹云霄 on 2017/3/15.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import "DiscussMainViewController.h"
#import "DiscussModuleViewController.h"
#import "DateCalibrationViewController.h"
#import "ForumViewController.h"
@interface DiscussMainViewController ()
@property (nonatomic,strong) DiscussModuleViewController *moduleVc;
@property (nonatomic,strong) DateCalibrationViewController *dateCalibrationVc;
@property (nonatomic,strong) ForumViewController *forumListVc;
@end
@implementation DiscussMainViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self addChildViewControllers];
}
#pragma mark -添加自控制器
- (void)addChildViewControllers
{
[self addChildViewController:self.moduleVc];
[self.view addSubview:self.moduleVc.view];
[self addChildViewController:self.dateCalibrationVc];
[self.view addSubview:self.dateCalibrationVc.view];
[self addChildViewController:self.forumListVc];
[self.view addSubview:self.forumListVc.view];
}
#pragma mark -布局加载完成
- (void)viewDidLayoutSubviews
{
[self.moduleVc.view mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view.mas_left).mas_offset(20);
make.right.equalTo(self.view.mas_right).mas_offset(-20);
make.top.equalTo(self.contentLabel.mas_bottom).mas_offset(10);
make.height.mas_equalTo(300);
}];
[self.dateCalibrationVc.view mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view.mas_left).mas_offset(20);
make.right.equalTo(self.view.mas_right).mas_offset(-20);
make.top.equalTo(self.moduleVc.view.mas_bottom).mas_offset(10);
make.height.mas_equalTo(60);
}];
[self.forumListVc.view mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view.mas_left).mas_offset(20);
make.right.equalTo(self.view.mas_right).mas_offset(-20);
make.top.equalTo(self.dateCalibrationVc.view.mas_bottom);
make.bottom.equalTo(self.view.mas_bottom);
}];
}
#pragma mark -lazy
- (UIViewController *)moduleVc
{
if (!_moduleVc) {
_moduleVc = [DiscussModuleViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_LEARNINGCENTER];
}
return _moduleVc;
}
- (UIViewController *)dateCalibrationVc
{
if (!_dateCalibrationVc) {
_dateCalibrationVc = [DateCalibrationViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_LEARNINGCENTER];
}
return _dateCalibrationVc;
}
- (UIViewController *)forumListVc
{
if (!_forumListVc) {
_forumListVc = [ForumViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_LEARNINGCENTER];
}
return _forumListVc;
}
@end