uikeyboard

How to pull up a UIKeyboard without a UITextField or UITextView?

帅比萌擦擦* 提交于 2019-11-26 22:54:30
问题 I'm currently developing an OpenGL ES game for the iPhone and iPod touch. I was wondering how I can easily pull up the UIKeyboard? Is there an official, documented possibility to pull up a UIKeyboard without using a UITextField of UITextView? 回答1: It's not "officially" possible - you can't access the UIKeyboard object at all while staying within Apple's guidelines. Creating an invisible UITextField, then calling [textField becomeFirstResponder] would do the job - you could even subclass

How to display UIView over keyboard in iOS

坚强是说给别人听的谎言 提交于 2019-11-26 20:42:44
问题 I want to create a simple view over keyboard, when users tap "Attach" button in inputAccessoryView. Something like this: Is there an easy way to do it? Or i should create my custom keyboard? 回答1: You can add that new subview to your application window. func attach(sender : UIButton) { // Calculate and replace the frame according to your keyboard frame var customView = UIView(frame: CGRect(x: 0, y: self.view.frame.size.height-300, width: self.view.frame.size.width, height: 300)) customView

Is there a way to prevent the keyboard from dismissing?

三世轮回 提交于 2019-11-26 20:32:47
问题 I realize that this is the inverse of most posts, but I would like for the keyboard to remain up even if the 'keyboard down' button is pressed . Specifically, I have a view with two UITextField s. With the following delegate method - (BOOL)textFieldShouldReturn:(UITextField *)textField { return NO; } I am able to keep the keyboard up even if the user presses the Done button on the keyboard or taps anywhere else on the screen EXCEPT for that pesky keyboard down button on the bottom right of

dismiss keyboard with a uiTextView

半城伤御伤魂 提交于 2019-11-26 19:01:41
问题 I am sure this is not that difficult, but I am having trouble finding info on how to dismiss a keyboard with the return/done key using a textview, not a textfield. here is what I have tried so far(which works with a textfield.) Thanks very much in advance for any help! // PostTravelQuestion.swift class PostTravelQuestion: UIViewController, UITextViewDelegate { @IBAction func closepostpage(sender: AnyObject) { dismissViewControllerAnimated(true, completion: nil) } @IBOutlet var postquestion:

InputAccessoryView docked at bottom

你说的曾经没有我的故事 提交于 2019-11-26 18:55:09
问题 I'm trying to achieve similar positioning behavior as the bottom text input bar in Apple's Messages app. I have tried many approaches, searched high and low and there are many similar questions but none have been satisfactory. To specify: There is a UIToolbar at the bottom of the view The toolbar is to follow the keyboard as the keyboard appears and disappears The toolbar should stay on top of the keyboard when the keyboard is visible When the keyboard is hidden, the toolbar stays ("docked")

iOS 8 keyboard hides my textview

那年仲夏 提交于 2019-11-26 18:03:55
问题 I have a UIViewController presented using self.accountViewController.modalPresentationStyle = UIModalPresentationFormSheet; and now in iOS 8 the last UITextView is hidden from the keyboard when it will pushed up. How to avoid It? 回答1: @Oleg's solution is good but it doesn't take into consideration keyboard changes in size while its already showing.. also, he hardcoded the animation duration and a few other parameters. See my solution below: Add an observer of

How do you dismiss the keyboard when editing a UITextField

自作多情 提交于 2019-11-26 16:58:55
I know that I need to tell my UITextField to resign first responder when I want to dismis the keyboard, but I'm not sure how to know when the user has pressed the "Done" key on the keyboard. Is there a notification I can watch for? kubi I set the delegate of the UITextField to my ViewController class. In that class I implemented this method as following: - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return NO; } Jason Coco If you connect the DidEndOnExit event of the text field to an action (IBAction) in InterfaceBuilder, it will be messaged when

change the keyboard layout to emoji

非 Y 不嫁゛ 提交于 2019-11-26 16:37:47
问题 is it possible to change the keyboard layout to emoji when a UITextField becomes the first responder ? or according to a user action like tapping a UIButton i know that i can change the keyboard layout to one of these 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, // Numbers and assorted punctuation.

iOS8: What's going on with moving views during keyboard transitions?

纵然是瞬间 提交于 2019-11-26 16:10:10
问题 After switching to iOS8, I'm getting weird behavior when I move views during a keyboard transition. Can anyone explain what's going on? Here's a minimal example to demonstrate the problem. I have a simple view with a UITextField and a UIButton . The function nudgeUp moves the text field and the button up by 10 points. It is triggered either by the buttonPressed callback, or the keyboardWillShow callback. When I tap the button, the code works as expected: buttonPressed calls nudgeUp and the

Allow only Numbers for UITextField input

依然范特西╮ 提交于 2019-11-26 15:17:46
The iPad does not have a "Numpad" keyboard like the iPhone/iPod does. I'm looking to find how I can restrict the user's keyboard to only accept values 0 through 9. I would imagine using UITextField's "shouldChangeCharactersInRange" but I don't know the best way to implement it. This is how I handled the problem on a SSN verification field, you can modify the max length and remove the if statement checking for keyboard type if you need to. There is also logic to suppress the max length alerts when the user is typing as opposed to pasting data. In the context of this code, BasicAlert() is a