iPad keyboard will not dismiss if modal ViewController presentation style is UIModalPresentationFormSheet

Note: See accepted answer (not top voted one) for solution as of iOS 4.3. This question is about a behavior discovered in the iPad keyboard, where it refuses to be dismissed if shown in a modal dialog with a navigation controller. Basically, if I present the navigation controller with the following line as below: navigationController.modalPresentationStyle … Read more

Move textfield when keyboard appears swift

I’m using Swift for programing with iOS and I’m using this code to move the UITextField, but it does not work. I call the function keyboardWillShow correctly, but the textfield doesn’t move. I’m using autolayout. override func viewDidLoad() { super.viewDidLoad() NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector(“keyboardWillShow:”), name:UIKeyboardWillShowNotification, object: nil); NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector(“keyboardWillHide:”), name:UIKeyboardWillHideNotification, object: nil); } deinit { … Read more

How to hide keyboard in swift on pressing return key?

I am using UITextfied while clicking on textfied keyboard appear but when i pressed the return key, keyboard is not disappearing. I used the following code: func textFieldShouldReturn(textField: UITextField!) -> Bool // called when ‘return’ key pressed. return NO to ignore. { return true; } the method resignfirstresponder is not getting in function. 20 Answers … Read more

How do I check when a UITextField changes?

I am trying to check when a text field changes, equivalent too the function used for textView – textViewDidChange so far I have done this: func textFieldDidBeginEditing(textField: UITextField) { if self.status.text == “” && self.username.text == “” { self.topRightButton.enabled = false } else { self.topRightButton.enabled = true } } Which kind of works, but the … Read more

Converting String to Int with Swift

The application basically calculates acceleration by inputting Initial and final velocity and time and then use a formula to calculate acceleration. However, since the values in the text boxes are string, I am unable to convert them to integers. @IBOutlet var txtBox1 : UITextField @IBOutlet var txtBox2 : UITextField @IBOutlet var txtBox3 : UITextField @IBOutlet … Read more