Iphone 在ios 4.0上强制使键盘消失

Iphone 在ios 4.0上强制使键盘消失,iphone,xcode,ios4,Iphone,Xcode,Ios4,当TextVIew被激活时,我使用我写的源代码在ios 3.1.3版本上使键盘不可见。(请参阅我的电子邮件上方或下方。) 但我不能让ios 4.0上的源代码使键盘不可见。 你能告诉我如何让键盘在ios 4.0版本上消失吗 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector (keyboardWillShow:)

当TextVIew被激活时,我使用我写的源代码在ios 3.1.3版本上使键盘不可见。(请参阅我的电子邮件上方或下方。) 但我不能让ios 4.0上的源代码使键盘不可见。 你能告诉我如何让键盘在ios 4.0版本上消失吗


[[NSNotificationCenter defaultCenter] addObserver:self 
                                      selector:@selector (keyboardWillShow:) 
                                      name:UIKeyboardWillShowNotification 
                                      object:nil];


-(void)keyboardWillShow:(NSNotification *)note 
{
    for(UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows]) 
    {
        for(UIView *keyboard in [keyboardWindow subviews]) 
        {
            if( [[keyboard description] hasPrefix:@"<UIKeyboard"]==YES) 
            {
                [keyboard setBounds:CGRectMake(keyboard.frame.origin.x+1000, 
                                               keyboard.frame.origin.y+1000,
                                               keyboard.frame.size.width, 
                                               keyboard.frame.size.height)];
            }
        }
    }
}

[[NSNotificationCenter defaultCenter]添加观察者:self
选择器:@选择器(键盘将显示:)
名称:UIKeyboardWillShowNotification
对象:无];
-(无效)键盘将显示:(NSNotification*)注释
{
用于[[UIApplication sharedApplication]windows]中的(UIWindow*键盘窗口)
{
用于(UIView*键盘位于[键盘窗口子视图])
{

如果([[keyboard description]hasPrefix:@“为什么不辞去FirstResponder?

必须在我的应用程序上激活textview。我想继续担任FirstResponder,但想强制移动键盘。你能给我一些提示吗?你想做什么来要求文本字段具有焦点而不允许文本输入?