【发布时间】:2010-08-23 19:09:31
【问题描述】:
我尝试更改 tableview 中单元格的 with,我不做自定义单元格,我只是子类 uitableviewcell。
这是课
@implementation customCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]) {
CGRect nouveauframe = CGRectMake(0.0, 0.0, 44,44);
self.frame = nouveauframe;
}
return self;
}
-(void)dealloc
{
[super dealloc];
}
@end
这是我在 cellForRowAtIndexPath 中创建单元格时:
static NSString *CellIdentifier = @"customCell";
customCell *cell = (customCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[customCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
[[cell textLabel]setText:[[[[Mission singletonMission] getObjectDataHistoireEncours] objectAtIndex:indexPath.row] valueForKey:[[langue singletonLangue] valeurBalise: @"_nom_label"]]];
cell.detailTextLabel.text = [[[[Mission singletonMission] getObjectDataHistoireEncours] objectAtIndex:indexPath.row] valueForKey:[[langue singletonLangue] valeurBalise: @"_valeur"]];
cell.userInteractionEnabled = FALSE;
retour = [cell retain];
但是我的单元格的宽度没有改变,为什么?
【问题讨论】:
-
请注意消息格式(请参阅问题中的更改) - 每个代码行应以至少 4 个空格开头,以便看起来像一个代码(这些空格不会出现在最后发布)。
标签: iphone objective-c uitableview