gpt4 book ai didi

iphone - 激活 iPhone 键盘

转载 作者:行者123 更新时间:2023-12-03 20:36:00 28 4
gpt4 key购买 nike

我不敢相信我还没有找到任何关于此的文档,但我想知道如何命令键盘激活并接收来自它的输入。我可以找到在编辑文本字段时操作弹出键盘的所有示例。谢谢

最佳答案

您还可以使用 UIKeyInput 协议(protocol)来请求键盘,而无需创建隐藏文本字段。

@interface My : UIViewController <UIKeyInput> ...

然后在实现中类似这样

// Methods which make the keyboard work

- (BOOL) hasText
{
return YES;
}

- (void)deleteBackward
{
[self handleBackspace];
}

- (void) insertText:(NSString* )text
{
int n = [text length];
int i;
for (i = 0; i < n; i++)
{
[self handleKey:[text characterAtIndex:i]];
}
}

- (BOOL) canBecomeFirstResponder
{
return YES;
}

// Methods to manage the appearance of the keyboard

- (void) summonKeyboard
{
[self becomeFirstResponder];
}

- (void) dismissKeyboard
{
[self resignFirstResponder];
}

关于iphone - 激活 iPhone 键盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3098583/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com