N'Valeur de la Clé de l'Observation de Travail sur UITextView du Texte de Propriété?

Je vais avoir le pire temps d'obtenir la valeur de clé de l'observation de travail avec un UITextView la propriété text. Je peux ajouter avec succès l'observateur, je peux même supprimer ce même observateur. J'ai un tableview avec plusieurs cellules - certains ont UITextFields, certains ont UISegmentSelectors et on a un UITextView. TOUS les autres champs sont correctement observé par ma base de données objet (sous-classe de NSMangedObject) à l'EXCEPTION de la UITextView. Je peux poster le code si nécessaire.

Posté Code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *UserProfileCellIdentifier = @"UserProfileCellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
UserProfileCellIdentifier];
if (cell == nil) 
{
[_tableCellsNib instantiateWithOwner:self options:nil];
switch (indexPath.row)
{
//UserName Row
case UserNameRowIndex:
_textFieldCell.cellLabel.text = NSLocalizedString(@"UserNameLabel", @"User Profile TableView");
_textFieldCell.cellType = CellTypeNormal;
_textFieldCell.boundProperty = @"UserName";
_textFieldCell.tag = indexPath.row;
_textFieldCell.errorHandler = self;
_textFieldCell.boundControl = _textFieldCell.cellTextField;
[_textFieldCell addObserver:[MBUtilities getAppDelegate].userProfile forKeyPath:@"cellTextField.text" options:NSKeyValueObservingOptionNew context:NULL];
cell = _textFieldCell;
self.textFieldCell = nil;
break;
case PasswordRowIndex:
_textFieldCell.cellLabel.text = NSLocalizedString(@"PasswordLabel", @"User Profile TableView");
_textFieldCell.cellType = CellTypeNormal;
_textFieldCell.cellTextField.secureTextEntry = YES;
_textFieldCell.boundProperty = @"Password";
_textFieldCell.tag = indexPath.row;
_textFieldCell.errorHandler = self;
_textFieldCell.boundControl = _textFieldCell.cellTextField;
[_textFieldCell addObserver:[MBUtilities getAppDelegate].userProfile forKeyPath:@"cellTextField.text" options:NSKeyValueObservingOptionNew context:NULL];
cell = _textFieldCell;
self.textFieldCell = nil;
break;
case PasswordConfirmRowIndex:
_textFieldCell.cellLabel.text = NSLocalizedString(@"PasswordConfirmLabel", @"User Profile TableView");
_textFieldCell.cellType = CellTypeNormal;
_textFieldCell.cellTextField.secureTextEntry = YES;
_textFieldCell.tag = indexPath.row;
cell = _textFieldCell;
self.textFieldCell = nil;
break;
case FirstNameRowIndex:
_textFieldCell.cellLabel.text = NSLocalizedString(@"FirstNameLabel", @"User Profile TableView");
_textFieldCell.cellType = CellTypeNormal;
_textFieldCell.boundProperty = @"FirstName";
_textFieldCell.tag = indexPath.row;
_textFieldCell.errorHandler = self;
_textFieldCell.boundControl = _textFieldCell.cellTextField;
[_textFieldCell addObserver:[MBUtilities getAppDelegate].userProfile forKeyPath:@"cellTextField.text" options:NSKeyValueObservingOptionNew context:NULL];
cell = _textFieldCell;
self.textFieldCell = nil;
break;
case LastNameRowIndex:
_textFieldCell.cellLabel.text = NSLocalizedString(@"LastNameLabel", @"User Profile TableView");
_textFieldCell.cellType = CellTypeNormal;
_textFieldCell.boundProperty = @"LastName";
_textFieldCell.tag = indexPath.row;
_textFieldCell.errorHandler = self;
_textFieldCell.boundControl = _textFieldCell.cellTextField;
[_textFieldCell addObserver:[MBUtilities getAppDelegate].userProfile forKeyPath:@"cellTextField.text" options:NSKeyValueObservingOptionNew context:NULL];
cell = _textFieldCell;
self.textFieldCell = nil;
break;
case DateOfBirthRowIndex:
_textFieldCell.cellLabel.text = NSLocalizedString(@"BirthDateLabel", @"User Profile TableView");
_textFieldCell.cellType = CellTypeDatePicker;
_textFieldCell.boundProperty = @"DateOfBirth";
_textFieldCell.tag = indexPath.row;
_textFieldCell.errorHandler = self;
_textFieldCell.boundControl = _textFieldCell.cellTextField;
[_textFieldCell addObserver:[MBUtilities getAppDelegate].userProfile forKeyPath:@"cellTextField.text" options:NSKeyValueObservingOptionNew context:NULL];
cell = _textFieldCell;
self.textFieldCell = nil;
break;
case GenderSelfRowIndex:
_genderSelectCell.cellLabel.text = NSLocalizedString(@"UserSexLabel", @"User Profile TableView");
_genderSelectCell.boundProperty = @"GenderSelf";
_genderSelectCell.errorHandler = self;
_genderSelectCell.boundControl = _genderSelectCell.cellGenderSegment;
_genderSelectCell.tag = indexPath.row;
[_genderSelectCell addObserver:[MBUtilities getAppDelegate].userProfile forKeyPath:@"cellGenderSegment.selectedSegmentIndex" options:NSKeyValueObservingOptionNew context:NULL];
cell = _genderSelectCell;
self.genderSelectCell = nil;
break;
case GenderInterestedInRowIndex:
_genderSelectCell.cellLabel.text = NSLocalizedString(@"UserInterestedInLabel", @"User Profile TableView");
_genderSelectCell.boundProperty = @"GenderInterestedIn";
_genderSelectCell.errorHandler = self;
_genderSelectCell.boundControl = _genderSelectCell.cellGenderSegment;
_genderSelectCell.tag = indexPath.row;
[_genderSelectCell addObserver:[MBUtilities getAppDelegate].userProfile forKeyPath:@"cellGenderSegment.selectedSegmentIndex" options:NSKeyValueObservingOptionNew context:NULL];
cell = _genderSelectCell;
self.genderSelectCell = nil;
break;
case IntroductionRowIndex:
_textViewCell.cellLabel.text = NSLocalizedString(@"IntroductionLabel", @"User Profile TableView");
_textViewCell.boundControl = _textViewCell.cellTextView;
_textViewCell.errorHandler = self;
_textViewCell.boundProperty = @"Introduction";
_textViewCell.tag = indexPath.row;
[_textViewCell addObserver:[MBUtilities getAppDelegate].userProfile forKeyPath:@"cellTextView.text" options:NSKeyValueObservingOptionNew context:NULL];
cell = _textViewCell;
self.textViewCell = nil;
break;
};
}
return cell;
}

Discussion: Chaque cellule est chargée à partir d'un externe PLUME fichier ensuite initialisé avec des propriétés différentes. Toutes les cellules de travail avec la valeur de la clé de l'observation, sauf pour le dernier avec le UITextView. Permettez-moi de savoir si des informations supplémentaires sont nécessaires.

OriginalL'auteur jjm340 | 2011-06-13