1

我在使我的应用程序与 iphone 4.0 兼容时遇到问题

我的问题是这样的。

当我单击 UITextview 时,会显示自定义键盘

UIView *test=[[UIView alloc] initWithFrame:CGRectMake(0, 160, 320, 215)];
        UIExtendedKeyBoard *objKeyBoard =[[UIExtendedKeyBoard alloc] initWithFrame:[test bounds]];
        objKeyBoard.tag =1001;
        [test addSubview:objKeyBoard];
        [objKeyBoard release];
        [vTxtPoem setInputView:test];
        [test release];

但是当我单击特定按钮时,我需要在默认键盘和我的自定义键盘之间切换....我正在使用以下代码来执行此操作

[vTxtPoem setInputView:nil];

但它不起作用......即使它没有显示默认键盘......它仍然保持相同的自定义键盘。控制也来到了这条线上。

4

2 回答 2

4

我的第一个猜测是这样的:

[vTxtPoem resignFirstResponder];
[vTxtPoem setInputView:nil];
[vTxtPoem becomeFirstResponder];
于 2010-07-20T12:26:20.290 回答
3

更好的方法可能是

[vTxtPoem setInputView:nil];
[vTxtPoem reloadInputViews];

有关详细信息,请参阅http://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/instm/UIResponder/reloadInputViews

于 2012-06-08T17:22:57.533 回答