First:
The specific code is as follows:
#import "ViewController.h"@interfaceViewcontroller () <UITableViewDelegate,UITableViewDataSource>@property (nonatomic,strong) UITableView*Mytablev, @property (nonatomic,strong) Nsarray*contentary;@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; //additional setup after loading the view, typically from a nib.Self.contentary =[Nsarray array]; [Self creatui];}-(Ibaction) Leftaction: (ID) Sender {self.contentary=Self.myTableV.visibleCells; NSLog (@"----%@", self.contentary); UIButton*button = (uibutton*) sender; Button.selected= !button.selected; Cgaffinetransform transform; DoubleDuration =0.1; if(Button.tag = =1) {Transform= Cgaffinetransformmaketranslation (-[uiscreen mainscreen].bounds.size.width,0); }Else if(Button.tag = =2) { for(UITableViewCell *cellinchself.contentary) {[UIView animatewithduration:duration delay:0Options0animations:^{cell.transform=cgaffinetransformidentity; } Completion:^(BOOL finished) {}]; Duration+=0.1; } return; }Else{Transform= Cgaffinetransformmaketranslation ([UIScreen mainscreen].bounds.size.width,0); } for(UITableViewCell *cellinchself.contentary) {[UIView animatewithduration:duration delay:0Options0animations:^{cell.transform=transform; } Completion:^(BOOL finished) {}]; Duration+=0.1; } }-(void) creatui{Self.mytablev= [[UITableView alloc]initwithframe:cgrectmake (0,0, Self.view.bounds.size.width, Self.view.bounds.size.height- -) Style:uitableviewstyleplain]; Self.mytablev.Delegate=Self ; Self.myTableV.dataSource=Self ; Self.myTableV.tableFooterView=[[UIView alloc]init]; [Self.view AddSubview:self.myTableV];}-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (nsinteger) section{return 5;}-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) indexpath{StaticNSString *celliden =@"CELLS"; UITableViewCell*cell =[TableView Dequeuereusablecellwithidentifier:celliden]; if(!cell) {Cell=[[UITableViewCell Alloc]initwithstyle:uitableviewcellstyledefault Reuseidentifier:celliden]; } Cell.textLabel.text= [NSString stringWithFormat:@"%ld",(Long) Indexpath.row]; Cell.backgroundcolor= [[Uicolor blackcolor]colorwithalphacomponent:0.6]; returncell;}
Just make a record!
The use of Visiblecells in iOS development--uitableview