uikeyboard

How does one disable third party keyboards in Swift?

孤人 提交于 2019-11-29 04:07:16
Basically that's it, I haven't found a way to disable third party keyboard in my app, although I know it's possible 'cos I've seen it in apps like 1Password. Any ideas? Add this code in your AppDelegate func application(application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: String) -> Bool { if extensionPointIdentifier == UIApplicationKeyboardExtensionPointIdentifier { return false } return true } Swift 4: func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplicationExtensionPointIdentifier) -> Bool

UITextView inputView

时光总嘲笑我的痴心妄想 提交于 2019-11-29 03:17:49
问题 I'm making a custom input method for the iPad, I want to be able to replace the system keyboard with my input method and enter text via that input method. According to the documentation all I need to do is to set the inputView property with my view and it will be used instead of the system keyboard. I did that and it works, as far as showing the keyboard but how do I actually enter text into the text view? Supposedly the text view needs to adopt the UIKeyInput and I can use the protocol's

Keyboard handling just like in Messages app in iOS 7

那年仲夏 提交于 2019-11-29 02:03:37
I am implementing a view that is in some way similar to what happens in Messages app, so there is a view with UITextView attached to the bottom of the screen and there is also UITableView showing the main content. When it is tapped it slides up with the keyboard and when keyboard is dismissed it slides back to the bottom of the screen. That part I have and it is working perfectly - I just subscribed to keyboard notifications - will hide and wil show. The problem is that I have set keyboard dismiss mode on UITableView to interactive and I cannot capture changes to keyboard when it is panning.

UIKeyboardTypeNumberPad without a done button

 ̄綄美尐妖づ 提交于 2019-11-28 23:51:24
How can we implement UIKeyboardTypeNumberPad so that it will have a 'done' button? By default it does not have one. If I am not wrong then You want to ask as to how to add a custom "Done" button to keyboard for UIKeyboardTypeNumberPad . In that case this might be helpful. Declare a UIButton *doneButton in.h and add the following code to .m file - (void)addButtonToKeyboard { // create custom button if (doneButton == nil) { doneButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 163, 106, 53)]; } else { [doneButton setHidden:NO]; } [doneButton addTarget:self action:@selector(doneButtonClicked

Convert UIKeyboardFrameEndUserInfoKey to View or Window Coordinates

江枫思渺然 提交于 2019-11-28 19:13:13
For the constant UIKeyboardFrameEndUserInfoKey , in the Apple docs it says: These coordinates do not take into account any rotation factors applied to the window’s contents as a result of interface orientation changes. Thus, you may need to convert the rectangle to window coordinates (using the convertRect:fromWindow: method) or to view coordinates (using the convertRect:fromView: method) before using it. So if I use [view1 convertRect:rect fromView:view2] What would I insert for the above parameters to get it to convert the rotation values correctly? ie: view1 = ? rect = ? (the keyboard frame

UI Test deleting text in text field

元气小坏坏 提交于 2019-11-28 17:20:48
问题 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

Autolayout Constraint - Keyboard

旧城冷巷雨未停 提交于 2019-11-28 14:11:28
问题 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

iOS Keyboard Location and Orientation

眉间皱痕 提交于 2019-11-28 09:08:09
问题 I'm relatively new to iOS SDK, and I'm experiencing a very bizarre issue regarding the device keyboard location and orientation for an app I'm working on. The problem is that if the keyboard is open while the user multi-tasks or the app goes into background, after the user comes back to the app, the keyboard will be be displaced (with UIKeyboardWillChangeFrameNotification being raised), but in an incorrect orientation and location. Sometimes the keyboard shows up completely off the screen too

iPhone: Resign Keyboard with Done button action with XIB

风格不统一 提交于 2019-11-28 08:04:36
问题 hi i am working on UITextview how to Resign Keyboard, after keyboard "Done button" click Action, which XIB Thank you 回答1: 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

Leaving inputAccessoryView visible after keyboard is dismissed

妖精的绣舞 提交于 2019-11-28 05:47:24
What I'm trying to do is to create something similar to the "find on page" search function in Safari on iPad. I'm using a UIToolbar with some items in it and attached it to the keyboard by setting it as an inputAccessoryView on the UITextField . Works like a charm, but there is one thing I can't figure out. In Safari, when you search for something, the keyboard disappears but the tool bar remains on the bottom of the screen. Does anyone have a clue on how to accomplish this? The only solution I can think of is to respond to a keyboard dismissed event and then pull out the UIToolBar and create