Tabelle anzeigen mit benutzerdefinierter Zellen (programmgesteuert)

So weit, dass ich verwendet zum erstellen von benutzerdefinierter Federn machen meiner Zelle, wie ich wollte, aber dieses mal, die Höhe einer Zelle ändern von einem zum anderen, so dass I kann nicht erstellen Sie eine Feste Größe-cell nib.

Also habe ich beschlossen, erstellen Sie programmgesteuert ... Ist der Weg unterhalb der guter Weg, es zu erreichen ?

//Customize the appearance of table view cells.
- (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];
        UILabel *pseudoAndDate = [[UILabel alloc] initWithFrame:CGRectMake(0.0,0.0,320.0,20.0)];
        [pseudoAndDate setTag:1];
        [cell addSubview:pseudoAndDate];
        [pseudoAndDate release];
    }

    CommentRecord *thisRecord = [comments objectAtIndex:[indexPath row]];

    UILabel *label = (UILabel *)[cell viewWithTag:1];
    [label setText:[NSString stringWithFormat:@"%@ | %@",thisRecord.author,thisRecord.date]];

    return cell;
}

.. oder bin ich hier etwas fehlt ? Ursache so weit es scheint nicht zu funktionieren 😉

Dank,

Gotye.

InformationsquelleAutor gotye | 2010-03-27

Schreibe einen Kommentar