Pregunta

Soy muy nuevo en mac desarrollo de la aplicación.así que acaba de hacer algún ejercicio práctico.

Quiero crear un formato tableview que mostrar los datos de mi archivo plist.
Tengo una windowcontroller de la clase y de la ventana del controlador.xib archivo.
Puedo arrastrar y soltar NSTableView a el .xib archivo.
y el uso de este código para cargar archivo plist

- (void)windowDidLoad
{
    [super windowDidLoad];

    NSBundle *bundle = [NSBundle mainBundle];
    NSString *path = [bundle pathForResource:@"tenth" ofType:@"plist"];
    file = [[NSArray alloc] initWithContentsOfFile:path];

}

Ahora, ¿qué debo hacer para mostrar filas en el formato tableview??
El método que tengo que usar?y cómo??

como en el desarrollo de IOS que estamos utilizando

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

NSArray *temp = [file objectAtIndex:indexPath.row];
cell.textLabel.text = [temp objectAtIndex:0];
return cell;
}
¿Fue útil?

Solución

Usted puede utilizar cualquiera de los enlaces con un NSArrayController o implementar el NSTableViewDataSource protocolo de.

Se recomienda la lectura de: La Vista De La Tabla Guía De Programación.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top