我在访问 UITableViewCell 中的内容时遇到问题,我已将其放置在我的主 .xib 文件中。
该标签连接到 IBOutlet servicesCell。
并且table view cell里面的Label是通过IBOutlet serviceLabel连接的。
在运行时,我没有得到我要添加到该标签的文本。
以下是我的示例代码。
static NSString *ServiceIdentifier = @"ServiceIdentifier";
UITableViewCell *cell1 = [tableView dequeueReusableCellWithIdentifier:ServiceIdentifier];
if(cell1 == nil) {
[[NSBundle mainBundle] loadNibNamed:@"servicesCell" owner:self options:nil];
cell1 = servicesCell;
}
// label access
serviceLabel = (UILabel *)[cell1 viewWithTag:1];
serviceLabel.numberOfLines = 3;
serviceLabel.lineBreakMode = UILineBreakModeWordWrap;
[serviceLabel setTextAlignment:UITextAlignmentLeft];
[serviceLabel setText:@"Testing String"];
任何人有任何想法然后请帮助..
提前致谢..