I do this:
controllerData = [[Data alloc] initWithNibName:@"Data" bundle:nil];
controllerData.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[delegate.navigationControllerMenu presentModalViewController:controllerData animated:YES];
Then I get a view with a tableview and their cells. If I execute "[self dismissModalViewControllerAnimated:YES];" this view is dropped like I want to, but If load the view again I get a tableview with duplicate rows.
Do you know how can 开发者_StackOverflow中文版I avoid the duplicate rows when I reload the view?
Thanks and sorry for my bad english.
EDIT:
I load the items like this:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
DataCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[DataCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
int fila = indexPath.row;
DataManager *dataManager = [DataManager sharedDataManager];
DataTest *ob = [dataManager.dataArray objectAtIndex:fila];
cell.usuario.text = ob.usuario;
cell.fecha.text = ob.fecha;
return cell;
}
You are probably adding your array items to the datasource again. Check how you add the items and make sure you dont add them everytime you load the modalview
精彩评论