Tabellen mit UITableViewController

Objective-C: Protokolle deklarieren

Objective-C: Protokolle implementieren

Objective-C: Private Methoden

Tabellen, Tabellen-Styles

UITableView und UITableViewController

Anzahl Abschnitte / Zeilen

Abschnitte/Zelleninhalte

Beispielcode: tableView:cellForRowAtIndexPath:

- (UITableViewCell *)tableView:(UITableView *)tableView
                     cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"SimpleCell";

    // Cell-Objekt aus Pool wiederverwenden
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    // Oder neu erzeugen sofern kein Pool-Objekt vorhanden
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                        reuseIdentifier:CellIdentifier];
        [cell autorelease];
    }
    
    cell.textLabel.text = @"Some cell text";
    return cell;
}

Weitere Informationen

Ralf Ebert

Ralf Ebert is an independent software developer, technical writer and trainer. He makes apps for Mac OS X and iOS and builds software solutions for companies using Eclipse RCP and Ruby on Rails. He offers training courses for software developers and writes books and articles about software development.