(1) Effect
(2) Source code and resources download
Http://pan.baidu.com/s/1pJLo2PP
(3) Summary
The core is to use the cell inside the UITableView to make the same cell.
Correspondingly, because it is not the entire xib file, there are some differences when loading the cell, just take it from the cache pool (using the ID).
+ (Instancetype) Cellwithtableview: (UITableView *) tableview{ static nsstring *[email protected] "app"; Wpappcell *cell=[tableview Dequeuereusablecellwithidentifier:id]; return cell;}
The second knowledge point, is the state of judgment, in the assignment of the time to overwrite the new state (here is mainly the status of the download button), the following first method is assigned to check the status, the second method is to click the button after the button state value changes.
-(void) Setapp: (Wpapps *) app{ _app=app; Self.icon.image=[uiimage ImageNamed:app.icon]; Self.name.text=app.name; Self.desc.text=[nsstring stringwithformat:@ "%@ |%@", app.size,app.download]; if (!app.isdownloaded) { self.download.enabled=yes; } else{ self.download.enabled=no; }} -(Ibaction) clickdownload { self.download.enabled=no; self.app.downloaded=!self.app.isdownloaded;}
--there is a perpetual knowledge point: Code encapsulation.
iOS Dev-68 app download case: Take advantage of TableView's cell layout + cache pool Cell Reuse Note button State check