Dismiss iphone keyboard

后端 未结 5 838
一向
一向 2020-11-29 05:38

I am trying to recreate something similar to the popup keyboard used in safari.

\"alt<

5条回答
  •  我在风中等你
    2020-11-29 06:14

    If your building your own views in Interface Builder, set your view controller to be delegate for the text field and implement textFieldShouldReturn: from UITextFieldDelegate in your views controller.

    - (BOOL)textFieldShouldReturn:(UITextField *)theTextField 
    {
        NSLog(@"%@ textFieldShouldReturn", [self class]);
        [theTextField resignFirstResponder];
        // do stuff with the text
        NSLog(@"text = %@", [theTextField text]);
        return YES;
    }
    

    UITextFieldDelegate textFieldShouldReturn: in the iphone cocoa docs

提交回复
热议问题