uikeyboard

UIKeyboardBoundsUserInfoKey is deprecated, what to use instead?

▼魔方 西西 提交于 2019-11-27 10:11:40
I'm working on an iPad app using 3.2 sdk. I'm dealing with obtaining the keyboard size to prevent my textfields from hidding behind it. I'm getting a Warning in Xcode -> UIKeyboardBoundsUserInfoKey is deprecated what should I use instead not to get this warning? Jay I played with the previously offered solution but still had issues. Here's what I came up with instead: - (void)keyboardWillShow:(NSNotification *)aNotification { [self moveTextViewForKeyboard:aNotification up:YES]; } - (void)keyboardWillHide:(NSNotification *)aNotification { [self moveTextViewForKeyboard:aNotification up:NO]; } -

UITextView cursor below frame when changing frame

百般思念 提交于 2019-11-27 07:28:33
I have a UIViewCOntroller that contains a UITextView . When the keyboard appears I resize it like this: #pragma mark - Responding to keyboard events - (void)keyboardDidShow:(NSNotification *)notification { NSDictionary* info = [notification userInfo]; CGRect keyboardSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; CGRect newTextViewFrame = self.textView.frame; newTextViewFrame.size.height -= keyboardSize.size.height + 70; self.textView.frame = newTextViewFrame; self.textView.backgroundColor = [UIColor yellowColor]; } - (void)keyboardWillHide:(NSNotification *

How to dismiss keyboard when touching anywhere outside UITextField (in swift)?

妖精的绣舞 提交于 2019-11-27 06:24:39
I'm working on a project that have a UIViewController, on the view controller there is a UIScrollView and a UITextField on the scrollview. like this: I'm trying to dismiss the keyboard and hide it after typing some text in the textfield and tap anywhere outside the textfield. I've tried the following code: override func viewDidLoad() { super.viewDidLoad() self.textField.delegate = self; } override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { self.view.endEditing(true) } It works for me when I tap outside the scrollview, but when I tap on the scrollview nothing happens

Keyboard not Appearing when Tapping Text Box in UIWebView

非 Y 不嫁゛ 提交于 2019-11-27 05:37:50
I have a UITabViewController set up with two tabs, the second containing a web browser. The keyboard will not appear in my App unless I first display and dismiss a UIAlertView in the first tab. What could possibly be wrong? sonics876 Solved; I accidentally removed: [window makeKeyAndVisible]; The solution mentioned here didn't work for me. I had a persistent error that seemed to be an issue with iOS, or at least my build settings. I came up with a workaround . If you're still stuck like I was, try this. I think it will work. Here it is briefly. Check out my post if you need more detail. Put

UIView atop the Keyboard similar to iMessage App

这一生的挚爱 提交于 2019-11-27 04:13:33
问题 currently I'm attempting to basically implement and exact copy of Apples iMessage App. That means I need a UITextView that is docked at the bottom of the screen, and moves up when it becomes firstResponder. - That's pretty easy actually. There's a bazillion ways to do that and two of the most common are of course animating the view upwards or downwards if a notification was received. The other is to do it via the inputAccessoryView . Sadly some of the features the one has, the other doesn't.

Programmatically change UITextField Keyboard type

不打扰是莪最后的温柔 提交于 2019-11-27 02:31:52
Is it possible to programmatically change the keyboard type of a uitextfield so that something like this would be possible: if(user is prompted for numeric input only) [textField setKeyboardType: @"Number Pad"]; if(user is prompted for alphanumeric input) [textField setKeyboardType: @"Default"]; PengOne There is a keyboardType property for a UITextField : typedef enum { UIKeyboardTypeDefault, // Default type for the current input method. UIKeyboardTypeASCIICapable, // Displays a keyboard which can enter ASCII characters, non-ASCII keyboards remain active UIKeyboardTypeNumbersAndPunctuation, //

How to add done button on keyboard on top of keyboard in IOS?

百般思念 提交于 2019-11-27 00:58:40
问题 I want to add the Done button on the top of keyboard on right side in iOS for a textView.Please tell me how can i do that? I want to achieve something similar to the above keyboard 回答1: It can be done using storyboard: Add UITextField to UIViewController view. Add UIToolbar in the first level of UIViewController Add UIBarButtonItem into the UIToolbar. Connect UItoolbar to the code using IBOutlet. Connect UIBarButtonItem to the code using IBAction (as didClick). Make the UITextField will be

Has anyone found a good way of using the new iOS5 keyboard events?

拈花ヽ惹草 提交于 2019-11-27 00:55:39
问题 During development of a recent feature for my iPad app, I realized that the new iOS5 keyboard docking/splitting behavior was causing huge issues. I use an inputAccessoryView for the keyboard with a text field on it similar to Safari's find on page feature. I display the keyboard over a scrollable UIWebView, so part my troubles come from having a shrunken UIWebview when the keyboard is docked and having a (mostly) fullscreen webview when it is undocked. The main issues I have run into with the

Change text of “Return” keyboard button

倾然丶 夕夏残阳落幕 提交于 2019-11-27 00:30:23
How can I change the standard text of the "Return" button to something else? I want it to be "Add". Unfortunately, you can change "Return" into only one of these predefined labels with the returnKeyType property: Return (default) Go Google Join Next Route Search Send Yahoo Done Emergency Call Continue (as of iOS 9) So maybe you should choose "Next" if a data entry kind of activity is what you're after. More information here . AmyNguyen You can use this simple way: [textField setReturnKeyType:UIReturnKeyNext]; or [textField setReturnKeyType:UIReturnKeyGo]; instead of "Add" button. Other, you

How to get height of Keyboard?

跟風遠走 提交于 2019-11-27 00:11:20
The height of a keyboard on varying iOS devices is different. Does anybody know how I can get height of a device's keyboard programmatically? roc In Swift: You can get the keyboard height by subscribing to the UIKeyboardWillShowNotification notification. (Assuming you want to know what the height will be before it's shown). Something like this: Swift 2 NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillShow:", name: UIKeyboardWillShowNotification, object: nil) Swift 3 NotificationCenter.default.addObserver( self, selector: #selector(keyboardWillShow), name: