views:

123

answers:

0

Hello, I have a navigation-based application that has a scrolling UITableView filled with the contents of a directory. Somehow, when I try to scroll a new cell into view, the application crashes. I have determined that it goes down to these lines of code in

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

    NSString *cellText = [contentArray objectAtIndex:indexPath.row];
    cell.textLabel.text = cellText;

}

Now why this is crashing, I don't know. contentArray is a NSArray with the table data. If you need a bit more code to tell:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {  
    return 1;  
}  
- (NSInteger)tableView:(UITableView *)tableView    
 numberOfRowsInSection:(NSInteger)section {  
    return [contentArray count];  
}
- (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];
    }
    NSUInteger intt = indexPath.row;
    NSString *cellText = [contentArray objectAtIndex:intt];
    cell.textLabel.text = cellText;
    // Configure the cell.

return cell;
}

Please help me with this problem,

HiGuy