小编jjm*_*340的帖子

密钥值观察是否适用于UITextView的文本属性?

我正在使用UITextView的text属性获得关键值观察的最糟糕时间.我可以成功添加观察者,我甚至可以删除同一个观察者.我有一个包含几个单元格的tableview - 一些有UITextFields,一些有UISegmentSelectors,另一个有UITextView.对于UITextView,我的核心数据对象(NSMangedObject的子类)EXCEPT成功观察到所有其余字段.我可以根据需要发布代码.

发布代码:

- (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"); …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

15
推荐指数
2
解决办法
1万
查看次数

标签 统计

ios ×1

iphone ×1

objective-c ×1