Langsam Scrollen UITableView?

Meine UITableView, nachdem die Nachrichten (Inhalte) geladen wird, in die Zellen, Erfahrungen eine sehr merkliche Verzögerung in Blättern und manchmal friert für ein paar Sekunden. Das ist seltsam, weil alle Nachrichten geladen werden, wenn der Benutzer scrollt. Irgendwelche Ideen auf, wie man das schnelle scrollen kein problem?

Danke!

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

    static NSString *simpleTableIdentifier = @"MailCell";

    MailCell *cell = (MailCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
    if (cell == nil)
    {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"MailCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];

        //Anything that should be the same on EACH cell should be here.

        UIView *myBackView = [[UIView alloc] initWithFrame:cell.frame];
        myBackView.backgroundColor = [UIColor colorWithRed:40.0/255.0 green:148.0/255.0 blue:196.0/255.0 alpha:1];
        cell.selectedBackgroundView = myBackView;

        cell.messageText.textAlignment = NSTextAlignmentLeft;
        cell.messageText.lineBreakMode = NSLineBreakByTruncatingTail;
    }

    NSUInteger row = [indexPath row];

    //Extract Data

    //Use the message object instead of the multiple arrays.

    CTCoreMessage *message = [[self allMessages] objectAtIndex:row];

    //Sender

    CTCoreAddress *sender = [message sender];
    NSString *senderName = [sender name];

    //Subject

    NSString *subject = [message subject];
    if ([subject length] == 0)
    {
        subject = @"(No Subject)";
    }

    //Body

    BOOL isPlain = YES;
    NSString *body = [message bodyPreferringPlainText:&isPlain];
    body = [[body componentsSeparatedByCharactersInSet:
             [NSCharacterSet whitespaceAndNewlineCharacterSet]]
            componentsJoinedByString:@" "];
    body = [body stringByReplacingOccurrencesOfString:@"  " withString:@" "];

    //Populate Cell

    [[cell nameText] setText:senderName];
    [[cell subjectField] setText:subject];
    [[cell messageText] setText:body];

    if ([message isUnread])
    {
        cell.nameText.textColor = [UIColor colorWithRed:15.0/255.0 green:140.0/255.0 blue:198.0/255.0 alpha:1];
    }
    else
    {
        cell.nameText.textColor = [UIColor blackColor];
    }

    return cell;

}

InformationsquelleAutor | 2013-05-27

Schreibe einen Kommentar