iOS Edge Learning--tableview batch operation

Source: Internet
Author: User

First, TableView batch operation method one: (Custom)

<1> add ImageView control in storyboard to manipulate the display icon when cell is selected

<2> drag lines to establish a connection to the ImageView control in a custom control class

<3> adds a control to the model class that controls whether the ImageView is displaying data. Using the MVC idea, M changes, V will follow the changes. Do not directly get the cell to modify the display state of the ImageView, which will cause confusion in cell recycling

Code in the <4> controller

The proxy method to implement TableView in the controller

1 //Proxy method to be executed when cell is selected or unchecked2- (void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) Indexpath3 {4     //Animation When cell is selected, Flash is gone5 [TableView Deselectrowatindexpath:indexpath animated:yes];6     //remove data from selected rows7Chaosdeal *deal =Self.dealarray[indexpath.row];8     //Modifying Data9Deal.checked= !deal.ischecked;Ten     //Refresh Data One [TableView Reloadrowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationfade]; A}

<5> Click the Delete button to bulk delete operations, do similar delete operations, do not traverse the collection to delete, before their own C # is easy to make this error, the array length is changing at any time, will error.

Second, the system comes with the batch operation, I did not write code implementation, directly to the teacher's code to take out the notes

<1> allow multi-select operation to be set to enter edit mode after the program is loaded

<2> Click button settings to turn off edit mode

<3> Click the Delete button to bulk delete

  

iOS Edge Learning--tableview batch operation

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.