我有一個數組,我用於提供表格視圖中的自定義單元格的內容 我不知道什麼是錯的,但是當我滾動tableview的contants oc單元格動態變化iphone:uitableview:滾動內容的單元格更改
請幫我解決這個
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
MyIdentifier = @"tblCellView";
NSString *offendersImagePath = [self applicationDocumentsDirectory];
//NSLog(@"%@", dbPath);
offendersImagePath=[offendersImagePath stringByAppendingPathComponent:@"Images"];
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if(cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
cell = aCustomCell;
aCustomCell=nil;
}
NSMutableArray *tempArray;//=[[NSMutableDictionary alloc] init];
tempArray=[offendersNamesList objectAtIndex:indexPath.row];
//NSLog(@"%d",indexPath.row);
offendersImagePath=[offendersImagePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.jpg",[tempArray objectAtIndex:0]]];
NSLog(offendersImagePath);
[[cell offendersImageView] setImage:[UIImage imageWithContentsOfFile:offendersImagePath]];
[cell.offendersNameLbl setText:[tempArray objectAtIndex:1]];
[cell.offendersViolation setText:[tempArray objectAtIndex:2]];
//[tempDictionary release];
//[cell setLabelText:[arryData objectAtIndex:indexPath.row]];
return cell;
}
可以從你的cellForRowAtIndexPath – saadnib 2011-05-03 13:52:25
張貼代碼完成提供代碼 – 2011-05-03 13:55:25