开发者

Hide keyboard and next line feature when using using text view

I'm using text view, for hiding keyboard i'm doing,

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {

    if([text isEqualToString:@"\n"]) {
        [textView resignFirstResponder]开发者_运维百科;
        return NO;
    }

    return YES;
}

but by doing so even if i'm hitting enter button, keyboard gets hide. What to do to go on next line directly? I wanna implement next line feature.


I suggest you to keep a toolbar with done button just above the keyboard.

In default hide the toolbar. when the textView is selected show the toolbar with that doneBarButton.

On doneBarButton selector hide the toolbar again and resign the textview.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜