如何在init之后定义UITableViewCellStyle?

时间:2011-08-13 08:54:46

标签: iphone objective-c ios uitableview

我的自定义单元格有以下代码:

ENSCustomCell *cell = (ENSCustomCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil)
{
    cell = [[[ENSCustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:cellIdentifier] autorelease];
}

NSUInteger row = [indexPath row];
NSDictionary *ens;
ens = [ensList objectAtIndex:row];

NSDictionary *toDic = [ens objectForKey:@"an"];
NSString *toString = @"";
NSInteger count = 0;
for (NSDictionary *str in toDic)
{
    count++;
    toString = [NSString stringWithFormat:@"%@%@", toString, [str objectForKey:@"username"]];
    if (count != toDic.count)
    {
        toString = [NSString stringWithFormat:@"%@%@", toString, @", "];
    }

}
[cell setDataWithTitle:toString andSubject:[ens objectForKey:@"betreff"]];
return cell;

如何在init之后设置右箭头(UITableViewCellStyle)? 是否有属性或方法(否则为initWithTyle)?

1 个答案:

答案 0 :(得分:2)

由于您说您正在尝试设置右箭头,因此您可能希望更改单元格的附件而不是整个单元格样式。使用单元格的accessoryType属性:

[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];