2

I'd like to disable UITextField's keyboard without hidding. is it possible? If it's so, could you show me how to do?

thanx

Carsh

Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99
Carsh
  • 21
  • 1
  • do you mean, disable the zoom effect (ignore everything) of keyboard when being pressed? or just ignore the type inputs? – janusfidel Jul 24 '12 at 08:47
  • what do you mean by disabling keyboard? – Vignesh Jul 24 '12 at 08:48
  • Are you saying that you want to show the keyboard but disable it? – Nitish Jul 24 '12 at 08:48
  • have a look at this http://stackoverflow.com/questions/5615806/disable-uitextfield-keyboard – thomas mannion Jul 24 '12 at 08:52
  • I meant what Nitish is saying. I want to show the keyboard but disable it. – Carsh Jul 24 '12 at 09:10
  • I'm curious: why do you want to do this? – matsr Jul 24 '12 at 09:52
  • I'm creating kinda typing game. This game has time limitation. When it's timeout, a gameover-window drops from the top(this is animation) and you can't keep playing after timeout. But the keyboard is still displayed under the gameover-window, and able to tap it now. I don't want to dismiss this keyboard but disable it. this is the reason why I want to disable the keybord. sorry my English is poor, if you can't understand this. – Carsh Jul 24 '12 at 11:06

4 Answers4

2

if you implement delegate method of uitextfield

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
   return NO;
}

It does not show the keyboard.

Mert
  • 6,025
  • 3
  • 21
  • 33
  • thanx for replying. but I'd like to show the keyboard but disable it. – Carsh Jul 25 '12 at 01:31
  • Yes after you have edited your question, I wrote another answer. Please look at that. http://stackoverflow.com/a/11629727/1416824 – Mert Jul 25 '12 at 08:53
0

I don't believe the UIKeyboard can be disabled without hiding it.

If you'd like to disable user interaction with the keyboard, you could add an extra UIWindow on top of your existing windows.

By overlaying the UIKeyboard with a transparent UIWindow, the user would be able to see the keyboard, without interacting with it.

Glenn
  • 1,085
  • 1
  • 9
  • 13
0

a haha , i have a very very ugly method. you can creat a view whichs frame = the keyboards frame. [view setBackgroundColor:[UIColor clearColor]]; [self addSubviews:view];

cloosen
  • 993
  • 7
  • 17
  • nice idea! but I couldn't set the view on the keyboard. – Carsh Jul 25 '12 at 01:33
  • the view is transparent and the user can not see it . its use is to shield the touch of the keyboard. when the keyboard is dismiss,the view will remove from the superview – cloosen Jul 25 '12 at 01:40
0

I did not try but this should work:

textField.inputView.userInteractionEnabled = NO;
Mert
  • 6,025
  • 3
  • 21
  • 33