Delete UITabelview and UITabelview

Source: Internet
Author: User

Delete UITabelview and UITabelview

Self. tableView ?. DeleteRowsAtIndexPaths ([indexPath, indexPath1], withRowAnimation:. Left) // title is the data source self. titles. removeAtIndex (0) self. titles. removeAtIndex (0)

2016-07-30 21:44:26.613 UITableViewLearn[14976:575144] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (4) must be equal to the number of rows contained in that section before the update (4), plus or minus the number of rows inserted or deleted from that section (0 inserted, 2 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'

UIKit is calleddeleteRowsAtIndexPathsThe data source consistency is determined. If the data source is inconsistent, an exception is thrown. However, it only determines whether the number of cells is consistent. If you delete data in columns 0th and 1 and then delete cells in columns 2nd and 3, no error is reported.

Let indexPath = NSIndexPath. init (forRow: 2, inSection: 0) let indexPath1 = NSIndexPath. init (forRow: 3, inSection: 0) // title is the data source self. titles. removeAtIndex (0) self. titles. removeAtIndex (0) self. tableView ?. DeleteRowsAtIndexPaths ([indexPath, indexPath1], withRowAnimation:. Left)

No error is reported.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.