美文网首页iosiOS_UIKit
UIInputViewController自定义键盘

UIInputViewController自定义键盘

作者: 絮语时光杨 | 来源:发表于2018-05-14 11:51 被阅读1次

    @protocol UITextDocumentProxy <UIKeyInput>

    @property (nullable, nonatomic, readonly) NSString *documentContextBeforeInput;
    @property (nullable, nonatomic, readonly) NSString *documentContextAfterInput;
    @property (nullable, nonatomic, readonly) NSString *selectedText API_AVAILABLE(ios(11.0));

    // An app can store UITextInputMode in its document context, when user switches to the document, the host will pass the inputMode as documentInputMode to the UIInputViewController,
    // which can switch to the inputMode and set primaryLanguage if it supports it.
    @property (nullable, nonatomic, readonly) UITextInputMode *documentInputMode NS_AVAILABLE_IOS(10_0);

    @property (nonatomic, readonly, copy) NSUUID *documentIdentifier API_AVAILABLE(ios(11.0));

    • (void)adjustTextPositionByCharacterOffset:(NSInteger)offset;

    @end

    NS_CLASS_AVAILABLE_IOS(8_0) @interface UIInputViewController : UIViewController <UITextInputDelegate>

    @property (nullable, nonatomic, strong) UIInputView *inputView;

    @property (nonatomic, readonly) id <UITextDocumentProxy> textDocumentProxy;

    // The primary language of the UIInputViewController. A BCP 47 language identifier such as en-US
    // If specified, this will supersede any PrimaryLanguage in the Info.plist.
    @property (nullable, nonatomic, copy) NSString *primaryLanguage;

    // When this property is set to YES, the system dictation key, if provided, will be disabled.
    @property (nonatomic) BOOL hasDictationKey;

    @property (nonatomic, readonly) BOOL hasFullAccess API_AVAILABLE(ios(11.0));
    @property (nonatomic, readonly) BOOL needsInputModeSwitchKey API_AVAILABLE(ios(11.0));

    • (void)dismissKeyboard;
    • (void)advanceToNextInputMode;

    // Launch inputMode list above the view when long pressing or swiping up from the view,
    // Advance to nextInputMode when short tapping on the view.
    // Example: [KeyboardButton addTarget:self action:@selector(handleInputModeListFromView:withEvent:) forControlEvents:UIControlEventAllTouchEvents].

    • (void)handleInputModeListFromView:(nonnull UIView *)view withEvent:(nonnull UIEvent *)event NS_AVAILABLE_IOS(10_0);

    // This will not provide a complete repository of a language's vocabulary.
    // It is solely intended to supplement existing lexicons.

    • (void)requestSupplementaryLexiconWithCompletion:(void (^)(UILexicon *))completionHandler;

    相关文章

      网友评论

      本文标题:UIInputViewController自定义键盘

      本文链接:https://www.haomeiwen.com/subject/ezmddftx.html