Question

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.

Was it helpful?

Solution

Following will fix the keyboard issue

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

![Simulator- loading=Hardware->Keyboard->Toggle Software Keyboard]">

OTHER TIPS

Try this:

Goto:

iOS Simulator -> Hardware -> Keyboard 

And Uncheck

'Connect Hardware Keyboard'

Or simply do: ⇧ shift + ⌘ Command + K

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

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

Xcode 6: Keyboard does not show up in simulator

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

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.

in this regard check two things

1-userInteractionEnabled=true

2- textFielfd.editable = YES;

Hope this will solve your problem.

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

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?

Add [textField canBecomeFirstresponder];

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top