UIKeyboardImpl: Difference between revisions

From iPhone Development Wiki
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
recursiveDefintion example on 7.1.2:
recursiveDefinition example on 7.1.2:
<source lang=boo>
<source lang=boo>
<UIKeyboardImpl: frame = (0 0; 320 216);>
<UIKeyboardImpl: frame = (0 0; 320 216);>
Line 13: Line 13:
   |    | <UIKBDimmingView: frame = (0 0; 320 216);>
   |    | <UIKBDimmingView: frame = (0 0; 320 216);>
</source>
</source>
== Accessing the shared instance ==
{{Function signature|signature=+ (UIKeyboardImpl *)sharedInstance;|firmware=2.0 –}}
This method is used to access the shared UIKeyboardImpl instance.
== Programmatically inserting text ==
{{Function signature|signature=- (void)addInputString:(NSString *)string;|firmware=2.0 –}}
You can use this method to insert text into the current text field or text view.<ref>https://code.google.com/p/hid-support/source/browse/trunk/hidspringboard/Tweak.xm#789</ref>
<br />
'''As of iOS 13, this method no longer works.''' The following code can produce the same result on iOS 13 and later:
<source lang="objc">
__block UIKeyboardImpl *kb = [%c(UIKeyboardImpl) sharedInstance];
UIKeyboardTaskQueue *queue = kb.taskQueue;
[queue addTask:^(UIKeyboardTaskExecutionContext *context, int arg2)
{
[kb addInputString:insert withFlags:0 executionContext:context];
}];
</source>
<br />
----
<references />
{{occlass|library=UIKit.framework|navbox=on}}

Latest revision as of 19:37, 6 June 2020

recursiveDefinition example on 7.1.2:

<UIKeyboardImpl: frame = (0 0; 320 216);>
   | <UIKeyboardLayoutStar: frame = (0 0; 320 216);>
   |    | <UIKBBackgroundView: frame = (0 0; 320 216);>
   |    | <UIKBKeyplaneView: frame = (0 0; 320 216);>
   |    |    | <UIKBKeyView: frame = (1 119; 40 42);>
   |    |    | <UIKBKeyView: frame = (279 119; 40 42);>
   |    |    | <UIKBKeyView: frame = (1 173; 38 42);>
   |    |    | <UIKBKeyView: frame = (41 173; 38 42);>
   |    |    | <UIKBKeyView: frame = (81 173; 158 42);>
   |    |    | <UIKBKeyView: frame = (241 173; 78 42);>
   |    | <UIKBDimmingView: frame = (0 0; 320 216);>

Accessing the shared instance

Signature + (UIKeyboardImpl *)sharedInstance;
Available in 2.0 –

This method is used to access the shared UIKeyboardImpl instance.

Programmatically inserting text

Signature - (void)addInputString:(NSString *)string;
Available in 2.0 –

You can use this method to insert text into the current text field or text view.[1]


As of iOS 13, this method no longer works. The following code can produce the same result on iOS 13 and later:

__block UIKeyboardImpl *kb = [%c(UIKeyboardImpl) sharedInstance];
UIKeyboardTaskQueue *queue = kb.taskQueue;

[queue addTask:^(UIKeyboardTaskExecutionContext *context, int arg2)
{
	[kb addInputString:insert withFlags:0 executionContext:context];
}];