UIKeyboard not appearing when tapping on UITextField

IosXcodeSwiftUitextfield

Ios Problem Overview


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.

Ios Solutions


Solution 1 - Ios

Following will fix the keyboard issue

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

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

Solution 2 - Ios

Try this:

Goto:

iOS Simulator -> Hardware -> Keyboard 

And Uncheck

'Connect Hardware Keyboard'

Or simply do: ⇧ shift + ⌘ Command + K

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

Solution 3 - Ios

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

https://stackoverflow.com/questions/24420873/swift-xcode-6-keyboard-not-showing-up-in-ios-simulator

Solution 4 - Ios

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.

Solution 5 - Ios

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

Solution 6 - Ios

in this regard check two things

1-userInteractionEnabled=true

2- textFielfd.editable = YES;

Hope this will solve your problem.

Solution 7 - Ios

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

Solution 8 - Ios

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?

Solution 9 - Ios

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

Solution 10 - Ios

Add [textField canBecomeFirstresponder];

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser3518271View Question on Stackoverflow
Solution 1 - IosShekhuView Answer on Stackoverflow
Solution 2 - IosKrishna Raj SalimView Answer on Stackoverflow
Solution 3 - IosMaryAnn MierauView Answer on Stackoverflow
Solution 4 - IosFred HsiaoView Answer on Stackoverflow
Solution 5 - IosJoeView Answer on Stackoverflow
Solution 6 - IosMacrosoft-DevView Answer on Stackoverflow
Solution 7 - IoswashloopsView Answer on Stackoverflow
Solution 8 - IosrbsView Answer on Stackoverflow
Solution 9 - IosRendelView Answer on Stackoverflow
Solution 10 - IosVineesh TPView Answer on Stackoverflow