0
何が間違っていますか? NSInvalidArgumentExceptionなぜkeyboardWasHiddenですか?
- (IBAction)textFieldDidEndEditing:(id)sender
{
if(!_isEditing)
return;
UITextField* textField = (UITextField*)sender;
NSString* newValue = [textField text];
UITableViewCell* cell = [self GetCellFromTextField:textField];
NSString* fieldName =[(UILabel*)[self GetLabelHeaderFromCell:cell] text];
NSIndexPath* indexPath= [self GetIndexPathForCell:cell];
[PersonalSection SetFieldValue:newValue AndFieldName:fieldName UsingIndexPath:indexPath AndPersonalInformation:self.personalInfoInUse];
_trackingEditTextField=nil;
[fieldName release];
_isEditing = FALSE;
}
- (IBAction)textFieldDidBeginEditing:(id)sender
{
_trackingEditTextField=(UITextField*)sender;
}
-(IBAction)textFieldDidChange
{
_isEditing=YES;
self.navigationItem.rightBarButtonItem = saveButton;
self.navigationItem.leftBarButtonItem = cancelButton;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[_trackingEditTextField resignFirstResponder];
return NO;
}
-(void)KeyboardDidShow:(NSNotification*) notification
{
if (keyboardShown)
return;
CGRect frame = tableView.frame;
frame.size.height -= 165;
tableView.frame = frame;
[tableView scrollToRowAtIndexPath:[self GetIndexPathForTextView:_trackingEditTextField] atScrollPosition:0 animated:YES];
keyboardShown = YES;
}
- (void)keyboardWasHidden:(NSNotification *)notification {
if (keyboardShown) {
CGRect frame = tableView.frame;
frame.size.height += 165;
tableView.frame = frame;
keyboardShown = NO;
}
}
例外火災
ファーストレスポンダを辞任しようとしている(つまり、私は、キーボード上の[完了]ボタンをクリックしたとき)が、キーボードがまだ表示され、それがUIKeyboardWillHideNotificationの受信機である、まだkeyboardWasHiddenを入力していませんでした