Skip to content

Commit dcc86b1

Browse files
committed
UIMessageInputView - placeHolder
1 parent bbe4b3b commit dcc86b1

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Coding_iOS/Controllers/TopicDetailViewController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ - (void)viewDidLoad
7373

7474
// 评论
7575
__weak typeof(self) weakSelf = self;
76-
_myMsgInputView = [UIMessageInputView messageInputViewWithType:UIMessageInputViewContentTypeTopic];
76+
_myMsgInputView = [UIMessageInputView messageInputViewWithType:UIMessageInputViewContentTypeTopic placeHolder:@"撰写答案"];
7777
_myMsgInputView.isAlwaysShow = YES;
7878
_myMsgInputView.delegate = self;
7979

@@ -632,7 +632,7 @@ - (instancetype)init
632632
- (void)setCurTopic:(ProjectTopic *)curTopic{
633633
_curTopic = curTopic;
634634

635-
_commentL.text = [NSString stringWithFormat:@"%d 条评论", _curTopic.child_count.intValue];
635+
_commentL.text = [NSString stringWithFormat:@"%d 条回答", _curTopic.child_count.intValue];
636636

637637
BOOL hasWatchers = _curTopic.watchers.count > 0;
638638
_tipL.hidden = hasWatchers;

Coding_iOS/Views/UIMessageInputView/UIMessageInputView.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ - (void)setInputState:(UIMessageInputViewState)inputState{
126126
}
127127
}
128128
- (void)setPlaceHolder:(NSString *)placeHolder{
129+
_placeHolder = placeHolder;
129130
if (_inputTextView && ![_inputTextView.placeholder isEqualToString:placeHolder]) {
130-
_placeHolder = placeHolder;
131131
_inputTextView.placeholder = placeHolder;
132132
}
133133
}
@@ -268,10 +268,11 @@ - (void)setToUser:(User *)toUser{
268268
_toUser = toUser;
269269
NSString *inputStr = [self inputStr];
270270
if (_inputTextView) {
271+
271272
if (_contentType != UIMessageInputViewContentTypePriMsg) {
272-
self.placeHolder = _toUser? [NSString stringWithFormat:@"回复 %@", _toUser.name]: @"撰写评论";
273+
_inputTextView.placeholder = _toUser? [NSString stringWithFormat:@"回复 %@", _toUser.name]: _placeHolder;
273274
}else{
274-
self.placeHolder = @"请输入私信内容";
275+
self.placeHolder = _placeHolder;
275276
}
276277
_inputTextView.selectedRange = NSMakeRange(0, _inputTextView.text.length);
277278
[_inputTextView insertText:inputStr? inputStr: @""];
@@ -361,7 +362,7 @@ + (instancetype)messageInputViewWithType:(UIMessageInputViewContentType)type pla
361362
if (placeHolder) {
362363
messageInputView.placeHolder = placeHolder;
363364
}else{
364-
messageInputView.placeHolder = @"说点什么吧...";
365+
messageInputView.placeHolder = @"撰写评论";
365366
}
366367
return messageInputView;
367368
}

0 commit comments

Comments
 (0)