@@ -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