ios - App Crashes When the Swipe to Delete feature is used Twice on the same row -


i have 1 uitableview in view controller. when run app, , use swipe delete function (say on row 3), deletes row first time. if add new data same row (row 3), , perform swipe delete action again, app crashes, , gives me exc_bad_access error. part of code:

func tableview(tableview: uitableview, commiteditingstyle editingstyle: uitableviewcelleditingstyle, forrowatindexpath indexpath: nsindexpath){      if editingstyle == uitableviewcelleditingstyle.delete {         todolist.removeobjectatindex(indexpath.row)         feedtimes = feedtimes - 1         ft.text = "\(todolist.count)"         tableview.reloaddata()     } } 

can explain why may happening? time.

seems have incorrect values update. check them repeatedly. way, in case, instead of reloaddata use:

deleterowsatindexpaths // or deletesections 

relatively table structure


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -