-
TableView
-
Property
Set the height of each row of cells@property (nonatomic)CGFloat rowHeight;Set the height of each group of headers@property (nonatomic)CGFloat sectionheaderheight;Set the split Line color@property (Nonatomic, retain)Uicolor *separatorcolorSetting the header control@property (Nonatomic, retain)UIView *tableheaderview;Set footer controls@property (Nonatomic, retain)UIView *tablefooterview;2. High end of group head GroupSelf. TableView. Sectionheaderheight =35}self.tableview22; //3. Set the head/tail view of the entire Tablview self . Tableview.tableheaderview = [[Uiswitch alloc] init]; self.tableviewuibutton Buttonwithtype:uibuttontypeinfodark]; //4. Set our split Line color (Clearcolor equivalent to canceling the system split line) // Self.tableView.separatorColor = [Uicolor Clearcolor]; //5. Set the split line style self.tableView< Span class= "hljs-variable" >.separatorstyle = Uitableviewcellseparatorstylenone;
- Data source Methods
How many groups are in the cell-(Nsinteger) Numberofsectionsintableview: (UITableView *) TableViewTell TableView how many lines are in section group-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (Nsinteger) SectionTell TableView what each line shows (each line of TableView is UITableViewCell)-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) IndexpathTell TableView header text for section group-(NSString *) TableView: (UITableView *) TableView titleforheaderinsection: (Nsinteger) SectionTells TableView the trailing caption text of section Group-(NSString *) TableView: (uitableview *) TableView titleforfooterinsection: (nsinteger) Section// Returns the index title of each group-(Nsarray *) Sectionindextitlesfortableview: (uitableview *) TableView //Returns the height of each cell-( CGFloat) TableView: (uitableview *) TableView Heightforrowatindexpath: (nsindexpath *) Indexpath//Delete data-( void) TableView: (uitableview *) TableView Commiteditingstyle: (uitableviewcelleditingstyle) Editingstyle Forrowatindexpath: (nsindexpath *) Indexpath; //
- Proxy method
As long as the implementation of this method, the left slide appears the function of the button (once the left slide appears n buttons, tableView into the editing mode, tableview.editing = YES)-(void) TableView: (UITableView *) TableView Commiteditingstyle: (uitableviewcelleditingstyle) Editingstyle Forrowatindexpath: (Nsindexpath *) IndexpathWhat button appears when left slide cell-(Nsarray *) TableView: (UITableView *) TableView Editactionsforrowatindexpath: (Nsindexpath *) Indexpath {uitableviewrowaction *action0 = [uitableviewrowaction rowactionwithstyle: Uitableviewrowactionstylenormal title:@ "Attention" handler:^ (uitableviewrowaction *action,Nsindexpath *indexpath) {NSLog (@ "Click on the Attention");Retract the left Slide button (Exit edit mode) TableView. editing =NO; }]; Uitableviewrowaction *action1 = [uitableviewrowaction rowactionwithstyle:uitableviewrowactionstyledefault title:@ "Delete" handler:^ (uitableviewrowaction *action, nsindexpath *indexpath) {[self. Winearray Removeobjectatindex:indexpath. row]; [TableView Deleterowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationautomatic]; }]; return @[action1, Action0];} //Agent method to get a bit of selected line, line number-(void) TableView: (uitableview *) TableView Didselectrowatindexpath: (Nsindexpath *) Indexpath; //Allow editing of selected lines-(BOOL) TableView: (uitableview *) TableView Caneditrowatindexpath: (Nsindexpath *) Indexpath;
-
UITableViewCell
-
Cell creation
-
Unregistered create
-
Find first from cache hold
uitableviewcell *cell=[tableview Dequeuereusablecellwithidentifier:id];
-
Not found in Create
if (nil== Cell) {Cell=[[uitableviewcell alloc]initwithstyle:uitableviewcellstylesubtitle Reuseidentifier:id]; }
IOS UI Basics