开发者

iPhone keyboard does not hide on device

开发者 https://www.devze.com 2023-02-08 06:46 出处:网络
I have a problem with the iPhone keyboard. Tried to follow several suggestions posted on this site but with no success.

I have a problem with the iPhone keyboard. Tried to follow several suggestions posted on this site but with no success.

I implemented two UITextFields each of which showing an action sheet with a UIPickerView. What I want to do is basically show the action sheet and hide the keyboard. To do this, I created the following method:

- (IBAction) closeScreenKeyboard:(id)sender
{
    [txtSize resignFirstResponder];
    [txtColour resignFirstResponder];
}

which I made it to trigger by the following event: Editing Did Begin, of both UITextFields.

So my logic does the following: On selecting either txtSize or txtColor, Editing Did Begin triggers two a开发者_开发知识库ctions, closeScreenKeyboard and showActionSheet.

Funnily enough, on the iPhone simulator this works perfectly but when I try it on a device, the keyboard remains there.

Can someone please post any fixes to this issue?


There is a method called

- (BOOL)endEditing:(BOOL)force;

which does the following: use to make the view or any subview that is the first responder resign (optionally force)

I think you should try this and I think you should first hide the keyboard and then show the actionsheet.

0

精彩评论

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