出于某种原因,我从我的核心数据模型中获取信息,但它显示的所有内容都是“(”在我的UITableView
中。现在我已经完成了以下操作:
NSLog (@"%@",reading.a1);
并记录以下内容:
2013-10-22 02:30:27.911 [6366:60b] (
"Lorem ipsum dolor sit amet, consectetur adipiscing elit."
)
2013-10-22 02:30:27.914 [6366:60b] (
"Proin condimentum et felis vel posuere."
)
2013-10-22 02:30:27.917 [6366:60b] (
"Proin sit amet est eget felis sagittis tempus."
)
这只是放在服务器中的一些拉丁文字。所以我看到信息正在被正确拉出,但由于某种原因,它不会出现在UITableViewCell
中。我的自定义单元格中包含以下代码:
#import "CustomCell"
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// configure control(s)
self.snippet = [[UILabel alloc ]initWithFrame:CGRectMake(90, 0, 200, 80)];
self.snippet.textColor = [UIColor redColor];
self.snippet.backgroundColor = [UIColor clearColor];
self.snippet.textAlignment = NSTextAlignmentLeft;
self.healthReading = [[UILabel alloc] initWithFrame:CGRectMake(5, 10, 300, 30)];
self.healthReading.textColor = [UIColor blackColor];
self.healthReading.font = [UIFont fontWithName:@"Arial" size:12.0f];
//[self addSubview:self.healthReading];
[self addSubview:self.snippet];
}
return self;
}
在我的UITableviewController
我有以下内容:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
FinalRead *readings = [_fetchedResultsController objectAtIndexPath:indexPath];
NSLog(@"%@",readings.a1);
cell.snippet.text = [NSString stringWithFormat:@"%@", readings.a1];
cell.backgroundColor = [UIColor clearColor];
UIImageView *imv = [[UIImageView alloc]initWithFrame:CGRectMake(20, 23, 60, 60)];
imv.image=[UIImage imageNamed:@"AppIcon60x60.png"];
[cell.contentView addSubview:imv];
return cell;
}
所以出于一些奇怪的原因,它只是出现了“(”在单元格中。任何想法?