tableView中的问题

Yas*_*BES 0 iphone objective-c

我的问题 :

[tableView reloadSections:[NSIndexSet indexSetWithIndex:[NSIndexPath indexPathForRow:1 inSection:currentIndex]] withRowAnimation:YES];  //passing argument 1 of indexSetWithindex makes integer from pointer without a cast   
Run Code Online (Sandbox Code Playgroud)
 - (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  


        }
}
Run Code Online (Sandbox Code Playgroud)

Joe*_*Joe 5

NSIndexSet存储整数不是NSIndexPaths.您需要传递给索引路径的唯一事情是该部分的无符号整数,而不是NSIndexPath对象.

NSIndexSet类表示唯一无符号整数的不可变集合,由于它们的使用方式而被称为索引.此集合称为索引集.

您的原始代码示例将如下所示

NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:currentIndex];
[tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationFade];
Run Code Online (Sandbox Code Playgroud)

正如Anna Karenina在评论中指出的那样:愤怒动画:不是在寻找一个BOOL而是在寻找一个UITableViewRowAnimation.确保检查文档或跳转到定义(^⌘D)以检查所调用方法的预期参数类型.