我遇到了ios6和UITableViewCell的问题.backgroundcolor未设置,这是它在ios5中的工作方式
-(UITableViewCell *)tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = nil;
NSString *contentForThisRow = [[self myArray] objectAtIndex:[indexPath row]];
cell = [tableView dequeueReusableCellWithIdentifier:@"noticeCell"];
if(cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"noticeCell"];
}
cell.textLabel.text = contentForThisRow;
id path = [NSString stringWithFormat:@"myip%@.jpeg", IDimage];
NSURL *url = [NSURL URLWithString:path];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data];
cell.imageView.image = img;
cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:15.0];
UIColor *cellBackground = [UIColor colorWithRed:235.0/255.0 green:245.0/255.0 blue:255.0/255.0 alpha:0.25];
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell setBackgroundColor:cellBackground];
return cell;
}
Run Code Online (Sandbox Code Playgroud)
但现在我无法重新设置它!
我该怎么做?
谢谢!
iSa*_*lis 11
使用
cell.contentView.backgroundColor= [UIColor blueColor];
Run Code Online (Sandbox Code Playgroud)
你可以使用清晰的颜色的细胞文本标签背景.
它应该工作.:)
| 归档时间: |
|
| 查看次数: |
1336 次 |
| 最近记录: |