54

This is the Signup VC ,as Tapping pops the white space Not the KeyBoardThis is the login VC ,as Tapping pops the white space Not the KeyBoard

I had been into a weird problem, As every other thing is working fine. All of sudden when I compile my application and got this problem, when I tapped on the UITextField white space is popping up, but the keyboard is not visible and I am not able to enter anything.

shim
  • 9,289
  • 12
  • 69
  • 108
  • it would be great to see screenshot attached... – Injectios Apr 28 '14 at 13:28
  • can u show the screen shot of the view – Anbu.Karthik Apr 28 '14 at 13:29
  • do check the post ,updated the screenshot –  Apr 28 '14 at 13:36
  • 1
    wow, have never seen anything similar... – Injectios Apr 28 '14 at 13:47
  • what about other text fields? same result? Do you use some controls/custom classes for UITextField? – Injectios Apr 28 '14 at 13:48
  • possible duplicate of [How to show the keyboard for a UIView](http://stackoverflow.com/questions/10819707/how-to-show-the-keyboard-for-a-uiview) – jww Apr 29 '14 at 04:38
  • 1
    @jww NOt duplicate of the mentioned question ,as i wrote in the question that everything is working fine ,all of sudden it stop working.Now today morning when i powered on my machine it is working fine.but got a new problem as now different views in the application are not pushing or poping.SO rather than wasting time to figure out the problem ,i rolled back my code to yesterday morning and saved a copy of faulty code.I will check the code for the problem later on. –  Apr 29 '14 at 06:40
  • Possible duplicate of [Xcode 6: Keyboard does not show up in simulator](http://stackoverflow.com/questions/24420873/xcode-6-keyboard-does-not-show-up-in-simulator) – Nhat Dinh Oct 26 '16 at 13:13

10 Answers10

107

Following will fix the keyboard issue

Simulator -> Hardware -> Keyboard -> Toggle Software Keyboard should solve this problem.

![Simulator->Hardware->Keyboard->Toggle Software Keyboard]

Shekhu
  • 1,998
  • 5
  • 23
  • 49
  • 1
    Thanks for the help,restarting the Mac fixed the problem ...@aiden –  Apr 29 '14 at 04:05
  • 2
    Ugh. Must have caught command shift k by accident and spent an hour trying to figure out why my keyboard wasn't appearing! Thanks. – earnshavian Jan 26 '15 at 19:12
  • Note that it works only at the runtime moment when the keyboard is supposed to appear. – Miroslav Apr 17 '16 at 18:47
49

Try this:

Goto:

iOS Simulator -> Hardware -> Keyboard 

And Uncheck

'Connect Hardware Keyboard'

Or simply do: ⇧ shift + ⌘ Command + K

Keep Coding......... :)

Krishna Raj Salim
  • 7,331
  • 5
  • 34
  • 66
7

This can also happen with Xcode 6/iOS 8 because of simulator settings:

Xcode 6: Keyboard does not show up in simulator

Community
  • 1
  • 1
MaryAnn Mierau
  • 270
  • 4
  • 8
4

Also make sure you aren't messing with yourTextField.inputView

Joe
  • 3,664
  • 25
  • 27
3

I've got the same problem but only on 5s simulator. And, I tried to go to simulator->reset content and settings. That actually solved the problem.

Fred Hsiao
  • 31
  • 1
2

in this regard check two things

1-userInteractionEnabled=true

2- textFielfd.editable = YES;

Hope this will solve your problem.

Macrosoft-Dev
  • 2,195
  • 1
  • 12
  • 15
2

check if at some point you're doing something like

[self.view endEditing:YES];
[self.myTextField resignFirstResponder];

or maybe you're assigning the first responder to some other control.

Hope it helps

washloops
  • 147
  • 3
1

Check if the outlet is mapped and the delegate set to the controller ? Also check if the controller has <UITextFieldDelegate> set. Send screen shot of the file inspector, perhaps?

rbs
  • 112
  • 3
1

Add [textField canBecomeFirstresponder];

Vineesh TP
  • 7,755
  • 12
  • 66
  • 130
1

I had the similar problem but on the actual device.
I talked to apple developer technical support (Apple DTS) and they told me that it's a swift compiler or Xcode bug.
I did a little workaround. Don't think that It's a best solution until apple solves this problem but it works without any problem now.

Just override the UITextField class:

class PBTextField : UITextField {

var keyboardShowDate = NSDate()

required init?(coder aDecoder: NSCoder)
{
    super.init(coder: aDecoder)

    self.initialisation()
}

override init(frame: CGRect)
{
    super.init(frame: frame)

    self.initialisation()
}

func initialisation()
{
    self.addTarget(self, action: "editingDidBegin:", forControlEvents: UIControlEvents.EditingDidBegin)
    self.addTarget(self, action: "editingDidEnd:", forControlEvents: UIControlEvents.EditingDidEnd)
}

// MARK: Delegates

func editingDidBegin(sender: AnyObject)
{
    self.becomeFirstResponder()
    self.keyboardShowDate = NSDate()
}

func editingDidEnd(sender: AnyObject)
{
    if(fabs(self.keyboardShowDate.timeIntervalSinceNow) <= 0.5)
    {
        self.becomeFirstResponder()
        dispatch_after(0.1, block: { () -> Void in
            self.becomeFirstResponder()
        })
    }
}

}

dispatch methods:

typealias dispatch_cancelable_block_t = ((cancel: Bool) -> Void)

func dispatch_async(block: dispatch_block_t, background: Bool = true) -> dispatch_cancelable_block_t?
{
return dispatch_after(0, block: block, background: background)
}

func dispatch_after(delay: NSTimeInterval = 0, block: dispatch_block_t, background: Bool = false) -> dispatch_cancelable_block_t?
{
var cancelableBlock : dispatch_cancelable_block_t?

let delayBlock : dispatch_cancelable_block_t = { (cancel) -> Void in
    if(cancel == false)
    {
        if(background)
        {
            block()
        }
        else
        {
            dispatch_async(dispatch_get_main_queue(), block)
        }
    }

    cancelableBlock = nil
};

cancelableBlock = delayBlock

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(delay * NSTimeInterval(NSEC_PER_SEC))), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), {
    if let cb = cancelableBlock
    {
        cb(cancel: false)
    }
})

return cancelableBlock
}

func cancel_block(block: dispatch_cancelable_block_t)
{
    block(cancel: true)
}

Hope this will help to someone.
If you got better solution, please let me know in comments.
Thanks
Giorgi

Rendel
  • 1,794
  • 3
  • 13
  • 16