开发者

How do I not present the keyboard on the touch event of a UITextField?

开发者 https://www.devze.com 2023-02-11 05:10 出处:网络
ok, I know that this topic has been addressed several times on here, but in all of the MANY examples I have looked at, I have been unable to find the answer I ne开发者_Go百科ed. All I have is a UIText

ok, I know that this topic has been addressed several times on here, but in all of the MANY examples I have looked at, I have been unable to find the answer I ne开发者_Go百科ed. All I have is a UITextField, and when I click on it, I need the keyboard to NOT show-up. Instead, I have a UIPopoverController that is showing up.

I have implemented this method:

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    [textField resignFirstResponder];
    NSLog(@"here");
    return NO;
}

Which should make it so the keyboard stays down, but I can't get this method to fire! What am I missing?

Thanks


I think your forgot to make the object this code lives in the delegate for the textField. Did you drag the delegate in Interface Builder or set the line textField.delegate = self.


hey use the delegate of textfield field in .h with and in .m with textField.delegate=self;

0

精彩评论

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