Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 上下文类型NSIndexSet不能与Swift 2.x的数组文字一起使用_Ios_Swift - Fatal编程技术网

Ios 上下文类型NSIndexSet不能与Swift 2.x的数组文字一起使用

Ios 上下文类型NSIndexSet不能与Swift 2.x的数组文字一起使用,ios,swift,Ios,Swift,我在下面的第4行中得到了错误,我试图重新加载表的一部分。我还尝试使用NSMakeRange[indexPath.section],1,但不断出现相同的错误 override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { if (indexPath.section == 1) { isSectionSelected = true

我在下面的第4行中得到了错误,我试图重新加载表的一部分。我还尝试使用NSMakeRange[indexPath.section],1,但不断出现相同的错误

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        if (indexPath.section == 1) {
            isSectionSelected = true
            self.tableView.reloadSections([indexPath.section], withRowAnimation: .None)
            self.performSegueWithIdentifier("serviceHistoryDetailView", sender: self)
        }
        tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
reloadSections需要NSIndexSet,而不是Int数组

您需要从indexath.section创建NSIndexSet。然后传递该NSIndexSet,而不是数组

self.tableView.reloadSections(NSIndexSet(index: indexPath.section), withRowAnimation: .None)

就这么简单。谢谢