1

我正在开发一个显示自定义键盘(类似于 Messenger)(包含图像)的应用程序。我被要求添加一个按钮,用动画改变键盘的框架。但是当我设置框架时,它根本没有改变。这可能吗?这可以做得很好还是我需要一些工作?

4

1 回答 1

0

可以使用 TextField 的 inputView 属性,

UITextField *textFieldWithCustomView;
UIView *customView;
[textFieldWithCustomView setInputView:customView];

当你想展开/折叠使用

- (void)toggleCustomView:(BOOL)expand
{
    if (expand) {
        [textFieldWithCustomView becomeFirstResponder];
    }
    else
    {
        [textFieldWithCustomView resignFirstResponder];
    }
}

当您想显示键盘使用时

[self toggleCustomView:YES];

希望这可以帮助。

于 2015-02-04T09:24:06.923 回答