IOS 6 子类不更新 UITableViewCell 中的 UITextField



我有一个UITableView,它处于原型模式。 我已经将 4 个标签和 2 个文本字段放入一个单元格中,其中一个单元格是基本文本输入并且工作正常。

我已经对TableViewCell进行了子分类。

头文件

#import <UIKit/UIKit.h>
@interface witLeagueSeriesGameDetailCell : UITableViewCell
@property (strong, nonatomic) IBOutlet UILabel *witGameNumber;
@property (strong, nonatomic) IBOutlet UITextField *witGameScore;
@property (strong, nonatomic) IBOutlet UITextField *witGameResult;
- (void) SetGameResult:(NSString *)resultName;
@end

实现文件

#import "witLeagueSeriesGameDetailCell.h"
#import "witAppDelegate.h"
@implementation witLeagueSeriesGameDetailCell
@synthesize witGameNumber=_witGameNumber;
@synthesize witGameScore = _witGameScore;
@synthesize witGameResult = _witGameResult;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}
- (void) SetGameResult:(NSString *)resultName{
    NSLog([NSString stringWithFormat:@"%@",resultName]);
    //self.witGameResult.text = resultName;
    [_witGameResult setText:resultName];
}

@end

表视图也已子类化。 它包含一个选取器,在输入相应的文本字段时会弹出该选取器。 当选择一行时,它将值传递回 SetGameResult 函数,我可以看到这个 使用 NSLog

但是,单元格的文本不会在屏幕上更新。

从代码中可以看出,我已经尝试了点概念方法和消息方法来设置文本。

TVC 选择器代码是

- (void) pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
    witLeagueSeriesGameDetailCell *myLabel = [[witLeagueSeriesGameDetailCell alloc] init];
    [myLabel SetGameResult:[NSString stringWithFormat:@"%@",[self.statusList objectAtIndex:row]]];
}

关于为什么它可能不显示在屏幕上的任何想法

这些是IBOutlet,所以它们应该连接到故事板上的那些。

最新更新