开发者

How to Hide keyBoard on return button itself in TextView in iPhone sdk?

开发者 https://www.devze.com 2023-02-07 03:47 出处:网络
In my iPhone App I am开发者_JAVA百科 using the control UItextView, I want to hide the keyBoard on \"return\" Button itself, I am not using any toolBar,NavigationBar and Idon\'t want to import any othe

In my iPhone App I am开发者_JAVA百科 using the control UItextView, I want to hide the keyBoard on "return" Button itself, I am not using any toolBar,NavigationBar and I don't want to import any other control like button on that View.

What shold I do to hide keyboard ?

Please Help and Suggest,

Thanks


You can use the shouldChangeTextInRange delegate and look for a line break:

-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString*)string
{
    if([string isEqualToString:@"\n"]){
        [textView resignFirstResponder];
    }

    return YES;
}
0

精彩评论

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