uikeyboard

Synchronizing Animations in keyboardWillShow keyboardWillHide — Hardware Keyboard & Virtual Keyboard Simultaneously

感情迁移 提交于 2019-11-30 04:56:34
Preamble So I have an application featuring a chat section, and I'm synchronizing the animation of the keyboard hiding and showing with the rise and fall of the chat input. Here's the code I'm using: SHOW: - (void) keyboardWillShow:(NSNotification *)note { NSDictionary *keyboardAnimationDetail = [note userInfo]; UIViewAnimationCurve animationCurve = [keyboardAnimationDetail[UIKeyboardAnimationCurveUserInfoKey] integerValue]; CGFloat duration = [keyboardAnimationDetail[UIKeyboardAnimationDurationUserInfoKey] floatValue]; NSValue* keyboardFrameBegin = [keyboardAnimationDetail valueForKey

Action of the “Go” button of the ios keyboard

折月煮酒 提交于 2019-11-30 01:03:24
How do I bind an action to the Go button of the keyboard in iOS ? Mick MacCallum Objective-C Assuming you're using a UITextField, you could use the <UITextFieldDelegate> method textFieldShouldReturn . - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; // Dismiss the keyboard. // Execute any additional code return YES; } Don't forget to assign the class you put this code in as the text field's delegate. self.someTextField.delegate = self; Or if you'd prefer to use UIControlEvents, you can do the following [someTextField addTarget:self action:@selector

UI Test deleting text in text field

旧巷老猫 提交于 2019-11-29 22:02:17
In my test I have a text field with a pre-existing text. I want to delete the content and type a new string. let textField = app.textFields textField.tap() // delete "Old value" textField.typeText("New value") When deleting string with hardware keyboard Recording generated for me nothing. After doing the same with software keyboard I got: let key = app.keys["Usuń"] // Polish name for the key key.tap() key.tap() ... // x times or app.keys["Usuń"].pressForDuration(1.5) I was worried that my test is language-dependent so I have created something like this for my supported languages: extension

How to detect when user changes keyboards?

余生颓废 提交于 2019-11-29 21:57:27
Is there some way to detect when the user changes keyboard types, specifically to the Emoji keyboard in this case? You can use UITextInputMode to detect the current language of the currentInputMode -- emoji is considered a language. From the docs : An instance of the UITextInputMode class represents the current text-input mode. You can use this object to determine the primary language currently being used for text input. You can test for the emoji keyboard like this: NSString *language = [[UITextInputMode currentInputMode] primaryLanguage]; BOOL isEmoji = [language isEqualToString:@"emoji"];

Autolayout Constraint - Keyboard

谁说胖子不能爱 提交于 2019-11-29 18:57:35
Im stuck trying to animate a table view smoothly which has an autolayout contraint. I have a reference to the constraint "keyboardHeight" in my .h and have linked this up in IB. All i want to do is animate the table view with the keyboard when it pops up. Here is my code: - (void)keyboardWillShow:(NSNotification *)notification { NSDictionary *info = [notification userInfo]; NSValue *kbFrame = [info objectForKey:UIKeyboardFrameEndUserInfoKey]; NSTimeInterval animationDuration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; CGRect keyboardFrame = [kbFrame CGRectValue]

iPad 'dismiss keyboard' button doesn't dismiss keyboard

别等时光非礼了梦想. 提交于 2019-11-29 18:12:20
I have a UITextField in a Landscape view, and when I press the 'dismiss keyboard' button in the lower right of the UIKeyboard view, the keyboard does NOT disappear. Is there a way to programmatically listen for when this key was pressed? Or is there a connection I am not seeing that will make this keyboard go away? This is iOS 4 and XCode 4. Thanks. I had same problem today and I wondered, wy it works in Apple's KeyboardAccessory Sample Code. So I did reverse engineering. The ViewController was not the mistake I made in my case. In the implementation of UIApplicationDelegate there is the entry

iPhone: Resign Keyboard with Done button action with XIB

泄露秘密 提交于 2019-11-29 14:16:20
hi i am working on UITextview how to Resign Keyboard, after keyboard "Done button" click Action, which XIB Thank you good guy hi if you want answer for, Resign the keyboard of UITextview with default "Done" button on keyboard, then this is answer for that - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { // Any new character added is passed in as the "text" parameter if([text isEqualToString:@"\n"]) { // Be sure to test for equality using the "isEqualToString" message [textView resignFirstResponder]; // Return FALSE so that the

iOS 8 : Keyboard Extension. Issue with adding pop up of keys

故事扮演 提交于 2019-11-29 14:08:08
问题 I am building my Keyboard Extension app and i have added key pop animation on button when user tap on it. It works fine for inside image but for top row image pop up area become hidden as it clip the subview. I tried with ClipToBound property and set as False. But still not working. Anyone have any idea how to fix this? adding subview on superview also not works. Image A is showing correct pop up as it is inside frame of keyboard. Image B is wrong as pop up clip inside frame. 回答1: I don't

unexpectedly found nil while unwrapping an Optional value keyboardWillShow

♀尐吖头ヾ 提交于 2019-11-29 11:56:43
I have this code below which runs when the keyboardWillShowNotification is called: func keyboardWillShow(_ notification: Notification) { //ERROR IN THE LINE BELOW keyboard = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as AnyObject).cgRectValue animaton = (notification.userInfo?[UIKeyboardAnimationDurationUserInfoKey] as AnyObject).doubleValue UIView.animate(withDuration: 0.4, animations: { () -> Void in self.scrollView.frame.size.height = self.scrollViewHeight - self.keyboard.height }) } I am getting an error on the second line saying: unexpectedly found nil while unwrapping an

dynamically change UIKeyboards return key

跟風遠走 提交于 2019-11-29 10:42:28
I have two UITextfield the user enters his name into the first and email into the second. I would like to know how to change the UIKeyboards return key depending if the name text field has an entry or not. For instance if nametextfield is empty then I would like the UIkeyboard return key to be Next else if the nametextfield has an entry in it then when the user selects the email text field I would like the return key to be submit. Is this possible? if so how would I go about accomplishing it? any help would be appreciated. You can have return key customized to prefixed values that you can see