Ios 上下文类型NSIndexSet不能与Swift 2.x的数组文字一起使用
我在下面的第4行中得到了错误,我试图重新加载表的一部分。我还尝试使用NSMakeRange[indexPath.section],1,但不断出现相同的错误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
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)
就这么简单。谢谢