Keyboard issue with iOS 4.2
My app works as supposed on an iPhone running iOS 4.1 but not on iOS 4.2. I have an UIInputField set to first res开发者_运维问答ponder but the keyboard does not show up. The becomeFirstResponder is called in the viewDidLoad method. Is it a bug or has Apple made drastic changes? I'm using Xcode 3.2.5.
Does the input field have User Interaction Enabled? This is now required in iOS 4.2.
-viewDidLoad
is called when your view is first initialized, not necessarily when it's displayed. Try calling -becomeFirstResponder
inside -viewDidAppear:
instead:
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[myField becomeFirstResponder];
}
Found a thread at the Apple Developer Forums (https://devforums.apple.com/message/325348#325348) where a solution was described. Set the UITextField property userInteractionEnabled to YES before a call to becomeFirstResponder is made, preferably in the viewDidLoad method.
精彩评论