开发者

Make Keyboard disappear by force on ios 4.0

When TextVIew was activated I used to make keyboard invisible on ios 3.1.3 version by using the source i wrote.(please refer to above or below my email.) but I can not make keyboard invisible any more with the source on ios 4.0. Could you tell me how to make key board disappear on the ios 4.0 version ?


[[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)];
            }
        }
    }
}


why not to resignFirstResponder ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜