开发者

Hide keyboard and next line feature when using using text view

开发者 https://www.devze.com 2023-03-15 21:18 出处:网络
I\'m using text view, for hiding keyboard i\'m doing, - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {

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

精彩评论

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

关注公众号