【发布时间】:2013-06-21 10:49:56
【问题描述】:
UILabel 是在界面生成器中创建的。它是 UITableViewCell 的一部分。它的颜色在 Interface Builder 中设置为红色。
我在这里创建单元格:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"notationcell";
NotationCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
// Configure the cell...
cell.notation = [self.notations objectAtIndex:indexPath.row];
UIColor *before = cell.symbolLabel.textColor;
cell.symbolLabel.text = @"new text";
UIColor *after = cell.symbolLabel.textColor;
return cell;
}
如预期的那样,Before 是红色的。但是更改文本后颜色变为 UIDeviceWhiteColorSpace 0 1,文本变为黑色。我正在使用自动布局。
为什么改变文字就意味着改变它的颜色?
【问题讨论】:
标签: ios uitableview uilabel nib uicolor