On an iPad with iOS 6 GM. I have 6 UITextFields, 3 UITextViews, and a UIButton that triggers a popover/actionsheet.
When I select one of the UITextFields or UITextViews, the keyboard pops up and the cursor appears, but I can't enter text. If I press the UIButton to show the popover and then tap outside it to dismiss it and go back to the UITextFields or UITextViews, they work.
I have UITextxxxx.delegate = self; set for all of them. "Enabled" and "User Interaction Enabled" checked off in the xibs, UITextFieldDelegate and UITextViewDelegate in my .h file as well as:
- (BOOL)disablesAutomaticKeyboardDismissal {
return NO;
}
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
return YES;
}
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
return YES;
}
- (IBAction)textFieldReturn:(id)sender {
[sender resignFirstResponder];
}
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView {
if (textView == notestextView){
[notestextView becomeFirstResponder];
}
if (textView == notestextViewTwo){
[notestextViewTwo becomeFirstResponder];
}
if (textView == notestextViewThree){
[notestextViewThree becomeFirstResponder];
}
return YES;
}
- (BOOL)textViewShouldEndEditing:(UITextView *)textView {
return YES;
}
I even tried to [xxxxxxx becomeFirstResponder]; in viewDidLoad. That pops the keyboard and places the cursor in the field at runtime, but I still can't type in it until I tap the UIButton to show the popover.
Anyone know why I can't type in the fields and why envoking the popover "fixes it"?
UPDATE 9/18: I pushed a new view in my app that just has a view with a textfield and a textview. Delegates are all set up. Same behavior. Keyboard and cursor appear, but no typing. That rules out the popovercontroller messing with things.
I'm strongly starting to think this is an iOS 6 bug. This is pretty much the same view I had in the iPhone version of my app on iOS 4 and 5 and I never had a problem. The only difference between the iPhone and iPad version is the way the imagepicker is presented. You have to use a popover for the iPad. That’s why I was thinking that the popover delegate had something to do with it.
Is there any kind of fundamental difference between implementing UITextFields and UITextViews in iOS 6 that I don't know about? Seems unlikely.
If it helps my app flows like this:
Main View with 10 buttons
- each button pushes a tableview via a navigation controller
- tableviews push a detail view - textfields and textviews exhibit behavior described above
- tableview also has an add button that pushes a modal view to add new items - textfields and textviews exhibit behavior described above
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…