我尝试改变一个tableview中的单元格,我不做一个自定义的单元格,我只是子类uitableviewcell。改变一个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个空格开头,以便看起来像代码(这些空间不会出现在最后的帖子中)。 – 2010-08-23 22:04:34