Skip to content

Commit e0c0dfa

Browse files
committed
loadView
1 parent d9d92ef commit e0c0dfa

36 files changed

Lines changed: 481 additions & 620 deletions

Coding_iOS/Controllers/AddTopicViewController.m

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,8 @@ - (void)viewDidLoad
3333
[super viewDidLoad];
3434
// Do any additional setup after loading the view.
3535
self.view.backgroundColor = [UIColor colorWithHexString:@"0xe5e5e5"];
36+
self.title = @"创建讨论";
3637

37-
}
38-
39-
- (void)didReceiveMemoryWarning
40-
{
41-
[super didReceiveMemoryWarning];
42-
// Dispose of any resources that can be recreated.
43-
}
44-
45-
- (void)loadView{
46-
[super loadView];
47-
48-
self.view = [[UIView alloc] init];
49-
5038
CGRect frame = CGRectMake(0, 30, kScreen_Width, 44);
5139
UIView *bgWhiteView = [[UIView alloc] initWithFrame:frame];
5240
bgWhiteView.backgroundColor = [UIColor whiteColor];
@@ -62,8 +50,6 @@ - (void)loadView{
6250
[_inputTitleView setValue:[UIFont boldSystemFontOfSize:15] forKeyPath:@"_placeholderLabel.font"];
6351
// [_inputTitleView becomeFirstResponder];
6452
[self.view addSubview:_inputTitleView];
65-
66-
6753

6854
frame.origin.y += 44+20;
6955
frame.size.height = kScreen_Height -64- 55-280-kHigher_iOS_6_1_DIS(20);
@@ -74,11 +60,16 @@ - (void)loadView{
7460
[self.view addSubview:_inputContentView];
7561

7662
self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithBtnTitle:@"完成" target:self action:@selector(addTopicBtnClicked:)];
77-
78-
self.title = @"创建讨论";
79-
63+
8064
self.myProTopic = [ProjectTopic topicWithPro:self.curProject];
8165
}
66+
67+
- (void)didReceiveMemoryWarning
68+
{
69+
[super didReceiveMemoryWarning];
70+
// Dispose of any resources that can be recreated.
71+
}
72+
8273
- (void)addTopicBtnClicked:(id)sender{
8374
self.myProTopic.title = _inputTitleView.text;
8475
self.myProTopic.content = _inputContentView.text;

Coding_iOS/Controllers/AddUserViewController.m

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,14 @@ @implementation AddUserViewController
2323
- (void)viewDidLoad {
2424
[super viewDidLoad];
2525
// Do any additional setup after loading the view.
26-
}
27-
28-
- (void)didReceiveMemoryWarning {
29-
[super didReceiveMemoryWarning];
30-
// Dispose of any resources that can be recreated.
31-
}
32-
33-
- (void)viewDidDisappear:(BOOL)animated{
34-
[super viewDidDisappear:animated];
35-
if (self.popSelfBlock) {
36-
self.popSelfBlock();
26+
if (self.type == AddUserTypeProject) {
27+
self.title = @"添加成员";
28+
_queryingArray = [NSMutableArray array];
29+
_searchedArray = [NSMutableArray array];
30+
}else if (self.type == AddUserTypeFollow){
31+
self.title = @"添加好友";
3732
}
38-
}
39-
40-
- (void)viewDidAppear:(BOOL)animated{
41-
[super viewDidAppear:animated];
4233

43-
if (_mySearchBar) {
44-
[self searchUserWithStr:_mySearchBar.text];
45-
}
46-
}
47-
48-
- (void)loadView{
49-
[super loadView];
50-
self.view = [[UIView alloc] init];
5134
_myTableView = ({
5235
UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
5336
tableView.backgroundColor = [UIColor clearColor];
@@ -70,15 +53,26 @@ - (void)loadView{
7053
searchBar;
7154
});
7255
_myTableView.tableHeaderView = _mySearchBar;
73-
74-
if (self.type == AddUserTypeProject) {
75-
self.title = @"添加成员";
76-
_queryingArray = [NSMutableArray array];
77-
_searchedArray = [NSMutableArray array];
78-
}else if (self.type == AddUserTypeFollow){
79-
self.title = @"添加好友";
56+
}
57+
58+
- (void)didReceiveMemoryWarning {
59+
[super didReceiveMemoryWarning];
60+
// Dispose of any resources that can be recreated.
61+
}
62+
63+
- (void)viewDidDisappear:(BOOL)animated{
64+
[super viewDidDisappear:animated];
65+
if (self.popSelfBlock) {
66+
self.popSelfBlock();
8067
}
68+
}
69+
70+
- (void)viewDidAppear:(BOOL)animated{
71+
[super viewDidAppear:animated];
8172

73+
if (_mySearchBar) {
74+
[self searchUserWithStr:_mySearchBar.text];
75+
}
8276
}
8377

8478
- (void)configAddedArrayWithMembers:(NSArray *)memberArray{

Coding_iOS/Controllers/CodeListViewController.m

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ @implementation CodeListViewController
1818
- (void)viewDidLoad {
1919
[super viewDidLoad];
2020
// Do any additional setup after loading the view.
21+
self.title = [[_myCodeTree.path componentsSeparatedByString:@"/"] lastObject];
22+
23+
ProjectCodeListView *listView = [[ProjectCodeListView alloc] initWithFrame:self.view.bounds project:_myProject andCodeTree:_myCodeTree];
24+
__weak typeof(self) weakSelf = self;
25+
listView.codeTreeFileOfRefBlock = ^(CodeTree_File *curCodeTreeFile, NSString *ref){
26+
[weakSelf goToVCWith:curCodeTreeFile andRef:ref];
27+
};
28+
[self.view addSubview:listView];
29+
[listView mas_makeConstraints:^(MASConstraintMaker *make) {
30+
make.edges.equalTo(self.view);
31+
}];
2132
}
2233

2334
- (void)didReceiveMemoryWarning {
@@ -35,23 +46,6 @@ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
3546
}
3647
*/
3748

38-
- (void)loadView{
39-
[super loadView];
40-
self.view = [[UIView alloc] init];
41-
42-
self.title = [[_myCodeTree.path componentsSeparatedByString:@"/"] lastObject];
43-
44-
ProjectCodeListView *listView = [[ProjectCodeListView alloc] initWithFrame:self.view.bounds project:_myProject andCodeTree:_myCodeTree];
45-
__weak typeof(self) weakSelf = self;
46-
listView.codeTreeFileOfRefBlock = ^(CodeTree_File *curCodeTreeFile, NSString *ref){
47-
[weakSelf goToVCWith:curCodeTreeFile andRef:ref];
48-
};
49-
[self.view addSubview:listView];
50-
[listView mas_makeConstraints:^(MASConstraintMaker *make) {
51-
make.edges.equalTo(self.view);
52-
}];
53-
}
54-
5549
- (void)goToVCWith:(CodeTree_File *)codeTreeFile andRef:(NSString *)ref{
5650
NSLog(@"%@", codeTreeFile.path);
5751
if ([codeTreeFile.mode isEqualToString:@"tree"]) {//文件夹

Coding_iOS/Controllers/CodeViewController.m

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,8 @@ + (CodeViewController *)codeVCWithProject:(Project *)project andCodeFile:(CodeFi
2727
- (void)viewDidLoad {
2828
[super viewDidLoad];
2929
// Do any additional setup after loading the view.
30-
}
31-
32-
- (void)didReceiveMemoryWarning {
33-
[super didReceiveMemoryWarning];
34-
// Dispose of any resources that can be recreated.
35-
}
36-
37-
- (void)loadView{
38-
[super loadView];
39-
CGRect frame = [UIView frameWithOutNav];
40-
self.view = [[UIView alloc] initWithFrame:frame];
41-
4230
self.title = [[_myCodeFile.path componentsSeparatedByString:@"/"] lastObject];
43-
31+
4432
{
4533
//用webView显示内容
4634
_codeContentView = [[UIWebView alloc] initWithFrame:self.view.bounds];
@@ -56,10 +44,18 @@ - (void)loadView{
5644
_activityIndicator.hidesWhenStopped = YES;
5745
[_activityIndicator setCenter:CGPointMake(CGRectGetWidth(_codeContentView.frame)/2, CGRectGetHeight(_codeContentView.frame)/2)];
5846
[_codeContentView addSubview:_activityIndicator];
47+
[_codeContentView mas_makeConstraints:^(MASConstraintMaker *make) {
48+
make.edges.equalTo(self.view);
49+
}];
5950
}
6051
[self sendRequest];
6152
}
6253

54+
- (void)didReceiveMemoryWarning {
55+
[super didReceiveMemoryWarning];
56+
// Dispose of any resources that can be recreated.
57+
}
58+
6359
#pragma mark Request
6460

6561
- (void)sendRequest{

Coding_iOS/Controllers/ConversationViewController.m

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,33 @@ - (void)viewDidLoad
4141
{
4242
[super viewDidLoad];
4343
// Do any additional setup after loading the view.
44+
self.title = _myPriMsgs.curFriend.name;
45+
// 添加myTableView
46+
_myTableView = ({
47+
UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
48+
tableView.backgroundColor = [UIColor clearColor];
49+
tableView.dataSource = self;
50+
tableView.delegate = self;
51+
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
52+
[tableView registerClass:[MessageCell class] forCellReuseIdentifier:kCellIdentifier_Message];
53+
[tableView registerClass:[MessageCell class] forCellReuseIdentifier:kCellIdentifier_MessageMedia];
54+
[self.view addSubview:tableView];
55+
[tableView mas_makeConstraints:^(MASConstraintMaker *make) {
56+
make.edges.equalTo(self.view);
57+
}];
58+
tableView;
59+
});
60+
// _refreshControl = [[ODRefreshControl alloc] initInScrollView:self.myTableView];
61+
// [_refreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged];
62+
63+
_myMsgInputView = [UIMessageInputView messageInputViewWithType:UIMessageInputViewTypeMedia placeHolder:@"请输入私信内容"];
64+
_myMsgInputView.isAlwaysShow = YES;
65+
_myMsgInputView.delegate = self;
66+
67+
UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0,CGRectGetHeight(_myMsgInputView.frame), 0.0);
68+
self.myTableView.contentInset = contentInsets;
69+
self.myTableView.scrollIndicatorInsets = contentInsets;
70+
[self refreshLoadMore:NO];
4471
}
4572

4673
- (void)viewWillDisappear:(BOOL)animated{
@@ -78,35 +105,6 @@ - (void)didReceiveMemoryWarning
78105
// Dispose of any resources that can be recreated.
79106
}
80107

81-
- (void)loadView{
82-
[super loadView];
83-
CGRect frame = [UIView frameWithOutNav];
84-
self.view = [[UIView alloc] initWithFrame:frame];
85-
self.title = _myPriMsgs.curFriend.name;
86-
// 添加myTableView
87-
_myTableView = ({
88-
UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
89-
tableView.backgroundColor = [UIColor clearColor];
90-
tableView.dataSource = self;
91-
tableView.delegate = self;
92-
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
93-
[tableView registerClass:[MessageCell class] forCellReuseIdentifier:kCellIdentifier_Message];
94-
[tableView registerClass:[MessageCell class] forCellReuseIdentifier:kCellIdentifier_MessageMedia];
95-
[self.view addSubview:tableView];
96-
tableView;
97-
});
98-
// _refreshControl = [[ODRefreshControl alloc] initInScrollView:self.myTableView];
99-
// [_refreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged];
100-
101-
_myMsgInputView = [UIMessageInputView messageInputViewWithType:UIMessageInputViewTypeMedia placeHolder:@"请输入私信内容"];
102-
_myMsgInputView.isAlwaysShow = YES;
103-
_myMsgInputView.delegate = self;
104-
105-
UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0,CGRectGetHeight(_myMsgInputView.frame), 0.0);
106-
self.myTableView.contentInset = contentInsets;
107-
self.myTableView.scrollIndicatorInsets = contentInsets;
108-
[self refreshLoadMore:NO];
109-
}
110108
#pragma mark UIMessageInputViewDelegate
111109
- (void)messageInputView:(UIMessageInputView *)inputView sendText:(NSString *)text{
112110
[self sendPrivateMessage:text];

Coding_iOS/Controllers/EditTaskViewController.m

Lines changed: 48 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -52,57 +52,6 @@ - (void)viewDidLoad
5252
{
5353
[super viewDidLoad];
5454
// Do any additional setup after loading the view.
55-
}
56-
57-
- (void)viewWillDisappear:(BOOL)animated{
58-
[super viewWillDisappear:animated];
59-
if (_myMsgInputView) {
60-
[_myMsgInputView prepareToDismiss];
61-
}
62-
}
63-
64-
- (void)viewDidAppear:(BOOL)animated{
65-
[super viewDidAppear:animated];
66-
// 键盘
67-
if (_myMsgInputView) {
68-
[_myMsgInputView prepareToShow];
69-
}
70-
[self.myTableView reloadData];
71-
}
72-
73-
- (void)didReceiveMemoryWarning
74-
{
75-
[super didReceiveMemoryWarning];
76-
// Dispose of any resources that can be recreated.
77-
}
78-
79-
- (void)loadView{
80-
[super loadView];
81-
self.view = [[UIView alloc] initWithFrame:[UIView frameWithOutNav]];
82-
_myTableView = ({
83-
UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
84-
tableView.backgroundColor = kColorTableSectionBg;
85-
tableView.delegate = self;
86-
tableView.dataSource = self;
87-
[tableView registerClass:[TaskContentCell class] forCellReuseIdentifier:kCellIdentifier_TaskContent];
88-
[tableView registerClass:[LeftImage_LRTextCell class] forCellReuseIdentifier:kCellIdentifier_LeftImage_LRText];
89-
[tableView registerClass:[TaskCommentCell class] forCellReuseIdentifier:kCellIdentifier_TaskComment];
90-
[tableView registerClass:[TaskCommentBlankCell class] forCellReuseIdentifier:kCellIdentifier_TaskCommentBlank];
91-
[tableView registerClass:[TaskCommentTopCell class] forCellReuseIdentifier:kCellIdentifier_TaskCommentTop];
92-
[tableView registerClass:[TaskDescriptionCell class] forCellReuseIdentifier:kCellIdentifier_TaskDescription];
93-
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
94-
tableView;
95-
});
96-
[self.view addSubview:_myTableView];
97-
//评论
98-
_myMsgInputView = [UIMessageInputView messageInputViewWithType:UIMessageInputViewTypeSimple];
99-
_myMsgInputView.isAlwaysShow = YES;
100-
_myMsgInputView.delegate = self;
101-
102-
UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0,CGRectGetHeight(_myMsgInputView.frame), 0.0);
103-
self.myTableView.contentInset = contentInsets;
104-
self.myTableView.scrollIndicatorInsets = contentInsets;
105-
10655
switch (_myTask.handleType) {
10756
case TaskHandleTypeAdd:{
10857
self.title = @"创建任务";
@@ -125,8 +74,33 @@ - (void)loadView{
12574
break;
12675
}
12776

77+
_myTableView = ({
78+
UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
79+
tableView.backgroundColor = kColorTableSectionBg;
80+
tableView.delegate = self;
81+
tableView.dataSource = self;
82+
[tableView registerClass:[TaskContentCell class] forCellReuseIdentifier:kCellIdentifier_TaskContent];
83+
[tableView registerClass:[LeftImage_LRTextCell class] forCellReuseIdentifier:kCellIdentifier_LeftImage_LRText];
84+
[tableView registerClass:[TaskCommentCell class] forCellReuseIdentifier:kCellIdentifier_TaskComment];
85+
[tableView registerClass:[TaskCommentBlankCell class] forCellReuseIdentifier:kCellIdentifier_TaskCommentBlank];
86+
[tableView registerClass:[TaskCommentTopCell class] forCellReuseIdentifier:kCellIdentifier_TaskCommentTop];
87+
[tableView registerClass:[TaskDescriptionCell class] forCellReuseIdentifier:kCellIdentifier_TaskDescription];
88+
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
89+
tableView;
90+
});
91+
[self.view addSubview:_myTableView];
92+
12893
if (self.myTask.handleType == TaskEditTypeAdd) {
12994
_myMsgInputView.hidden = YES;
95+
}else{
96+
//评论
97+
_myMsgInputView = [UIMessageInputView messageInputViewWithType:UIMessageInputViewTypeSimple];
98+
_myMsgInputView.isAlwaysShow = YES;
99+
_myMsgInputView.delegate = self;
100+
101+
UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0,CGRectGetHeight(_myMsgInputView.frame), 0.0);
102+
self.myTableView.contentInset = contentInsets;
103+
self.myTableView.scrollIndicatorInsets = contentInsets;
130104
}
131105

132106
[self.navigationItem setRightBarButtonItem:[UIBarButtonItem itemWithBtnTitle:@"完成" target:self action:@selector(doneBtnClicked)] animated:YES];
@@ -146,6 +120,29 @@ - (void)loadView{
146120
return @(enabled);
147121
}];
148122
}
123+
124+
- (void)viewWillDisappear:(BOOL)animated{
125+
[super viewWillDisappear:animated];
126+
if (_myMsgInputView) {
127+
[_myMsgInputView prepareToDismiss];
128+
}
129+
}
130+
131+
- (void)viewDidAppear:(BOOL)animated{
132+
[super viewDidAppear:animated];
133+
// 键盘
134+
if (_myMsgInputView) {
135+
[_myMsgInputView prepareToShow];
136+
}
137+
[self.myTableView reloadData];
138+
}
139+
140+
- (void)didReceiveMemoryWarning
141+
{
142+
[super didReceiveMemoryWarning];
143+
// Dispose of any resources that can be recreated.
144+
}
145+
149146
#pragma mark UIMessageInputViewDelegate
150147
- (void)messageInputView:(UIMessageInputView *)inputView sendText:(NSString *)text{
151148
[self sendCommentMessage:text];

0 commit comments

Comments
 (0)