2010-05-11 17 views

Respuesta

16

acaba de tener que reemplazar initWithFrame:reuseIdentifier: con lo siguiente.

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 
{ 
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) 
    { 
     // you might want to add the UIView to [self contentView] 
     // so that in edit's the cell's content will be automatically adjusted. 
     ABTableViewCellView *myUIView = [[ABTableViewCellView alloc] initWithFrame:CGRectZero]; 

     myUIView.opaque = YES; 
     contentViewForCell = myUIView; 
     [self addSubview:myUIView]; 
     [myUIView release]; 
    } 

    return self; 
} 

Además, Apple tiene un ejemplo como señala Loren pero utilizan initWithStyle:reuseIdentifier:

http://developer.apple.com/iphone/library/samplecode/TableViewSuite/Introduction/Intro.html

0

Otro ser la forma específica de entender es- initWithFrame: reuseIdentifier: está en desuso en iOS 3.0 . Utilice initWithStyle: reuseIdentifier: en lugar

simple Ejemplo- Código de error

static NSString *MyIdentifier = @"MyIdentifier"; 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; 
if (cell == nil) 
{ 
    cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];  
} 

código esperado

static NSString *MyIdentifier = @"MyIdentifier"; 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; 
if (cell == nil) 
{ 
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier]; 
} 
+0

Al hacer esto, puede ejecutar en cuestiones en las que la célula está ahí, pero es sólo invisible ... –

+0

@AriBraginsky ¿puede por favor explicar qué quiere decir exactamente por cuestiones e invisible aquí? –

Cuestiones relacionadas