Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.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 删除tableview单元格崩溃swift_Ios_Objective C_Swift_Uitableview - Fatal编程技术网

Ios 删除tableview单元格崩溃swift

Ios 删除tableview单元格崩溃swift,ios,objective-c,swift,uitableview,Ios,Objective C,Swift,Uitableview,您好,我想删除tableview单元格,出现以下错误 由于未捕获异常“NSInternalInconsistencyException”而终止应用程序,原因:“更新无效:节数无效。”。更新后表视图中包含的节数(4)必须等于更新前表视图中包含的节数(5),加上或减去插入或删除的节数(0插入,0删除) 这是代码 override func numberOfSectionsInTableView(tableView: UITableView) -> Int { retur

您好,我想删除tableview单元格,出现以下错误

由于未捕获异常“NSInternalInconsistencyException”而终止应用程序,原因:“更新无效:节数无效。”。更新后表视图中包含的节数(4)必须等于更新前表视图中包含的节数(5),加上或减去插入或删除的节数(0插入,0删除)

这是代码

     override func numberOfSectionsInTableView(tableView: UITableView) -> Int {

      return sectionTitle.count
    }

        override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

          let sTitle = sectionTitle[section] as? String
          let sectionAnimals = dict.objectForKey(sTitle!) as! NSArray
          print(sectionAnimals)
          return sectionAnimals.count

     }

         override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
                    let sTitle = sectionTitle.objectAtIndex(indexPath.section) as! NSString
        let sectionAnimals = dict.objectForKey(sTitle)
        let animal = sectionAnimals!.objectAtIndex(indexPath.row) as! NSString
        cell.video_name.text = animal as String

        let sectionAnimals1 = dict1.objectForKey(sTitle)
        let animal1 = sectionAnimals1!.objectAtIndex(indexPath.row) as! NSString
        cell.artist_name.text = animal1 as String
     }

    let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! DetailTableViewCell
    override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {

    let deleteAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Delete") { (action, indexPath) -> Void in
        tableView.beginUpdates()

        self.dict.removeObjectForKey(self.sectionTitle[indexPath.section])
        self.dict1.removeObjectForKey(self.sectionTitle[indexPath.section])
        self.dict2.removeObjectForKey(self.sectionTitle[indexPath.section])

        let newArr = NSMutableArray(array: self.sectionTitle)
        newArr.removeObjectAtIndex(indexPath.section)
        self.sectionTitle = newArr


        tableView.reloadData()
       tableView.endUpdates()

    }
}

萨拉姆。。。。。谢谢你!!!萨拉姆,没问题,很好,谢谢沙哈,是的,下次谢谢