My problem :
[tableView reloadSections:[NSIndexSet indexSetWithIndex:[NSIndexPath indexPathForRow:1 inSection:currentIndex]] withRowAnimation:YES]; //passing argument 1 of indexSetWithindex makes integer from pointer without a cast
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
if (!self.editing) {
if(indexPath.section%2!=0)
{
ConsultationCarteV *consultationCarteV = [[ConsultationCarteV alloc] initWithNibName:@"ConsultationCarteV" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[CartesManager sharedInstance].indexCarteCourante=indexPath.row ;
[CartesManager sharedInstance].isEditable = NO ;
[self.navigationController pushViewController:consultationCarteV animated:YES];
开发者_高级运维 [consultationCarteV release];
}
else {
currentIndex = indexPath.section +1 ;
[tableView reloadSections:[NSIndexSet indexSetWithIndex:[NSIndexPath indexPathForRow:1 inSection:currentIndex]] withRowAnimation:YES]; //passing argument 1 of indexSetWithindex makes integer from pointer without a cast
}
}
NSIndexSet
stores integers not NSIndexPath
s. The only thing you need to pass to the index path is the unsigned integer of the section and not an NSIndexPath object.
The NSIndexSet class represents an immutable collection of unique unsigned integers, known as indexes because of the way they are used. This collection is referred to as an index set.
Your original code example will look like this
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:currentIndex];
[tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationFade];
As Anna Karenina points out in the comments withRowAnimation: is not looking for a BOOL
but an UITableViewRowAnimation
. Make sure you check the documentation or Jump to Definition (^⌘D) to check the type of arguments that are expected for the methods you call.
精彩评论