I have view with text field -- subclassed from UIAlertView. In the textFieldShouldReturn delegate I call resignFirstResponder for text field and dism开发者_C百科issWithClickedButtonIndex for view. On the 3.x version everything fine, but on 4.0 keyboard still present on screen after view dismissing and doesn't disappear while app running. App compiled for 3.0 target and tested on 4.0 iPhone OS. One more thing - sometimes after dismissing alert - Done button on the keyboard replaces with Return button.. Any suggestions ?
Strange thing.. I wrote functions to find and animate out keyboard view by timer but keyboard can't be found while it present on the screen.. Something like this:
for( UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows] ){
for( UIView *keyboard in [keyboardWindow subviews] ){
NSString *desc = [keyboard description];
if( [desc hasPrefix:@"<UIKeyboard"]==YES ) {
// animate out
}
}
}
What is canResignFirstResponder
returning? I had the same problem you describe going to 4.0, fixed it by paying more attention to this function. If you're returning NO, try YES - sort out the conditions later if you find this has the desired effect.
精彩评论