开发者

Make Keyboard disappear by force on ios 4.0

开发者 https://www.devze.com 2023-01-15 18:09 出处:网络
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.)

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

精彩评论

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