TableView's DataSource Agent
Two data source methods for @required
1. Returns the number of cells in each session
-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (nsinteger) Section;
2. Create Tableviewcell (pay attention to reuse)
-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) Indexpath;
@optional
1. Return the number of session (group)
-(Nsinteger) Numberofsectionsintableview: (UITableView *) TableView;
2, set the corresponding group Headerview
-(Nullable NSString *) TableView: (UITableView *) TableView titleforheaderinsection: (nsinteger) Section;
3, set the corresponding group amount Footerview
-(Nullable NSString *) TableView: (UITableView *) TableView titleforfooterinsection: (nsinteger) Section;
------------------------------------Editing------------------------------------
4. Set whether a cell can be edited
-(BOOL) TableView: (UITableView *) TableView Caneditrowatindexpath: (Nsindexpath *) Indexpath;
5. Set whether the cell can be moved
-(BOOL) TableView: (UITableView *) TableView Canmoverowatindexpath: (Nsindexpath *) Indexpath;
6. Set the right index of TableView
-(Nullable nsarray<nsstring *> *) Sectionindextitlesfortableview: (UITableView *) TableView __tvos_prohibited;
7, click the index to jump to the corresponding session group
-(Nsinteger) TableView: (UITableView *) TableView sectionforsectionindextitle: (NSString *) title Atindex: (Nsinteger) Index __tvos_prohibited;
8. Processing data changes that correspond to the editing state of the submission
-(void) TableView: (UITableView *) TableView Commiteditingstyle: (uitableviewcelleditingstyle) Editingstyle Forrowatindexpath: (Nsindexpath *) Indexpath;
9. Handling data changes in mobile cells
-(void) TableView: (UITableView *) TableView Moverowatindexpath: (Nsindexpath *) Sourceindexpath Toindexpath: ( Nsindexpath *) Destinationindexpath;
------------------------------------uitableviewdelegate------------------------------------
1, processing display
- (void) TableView: (UITableView *) TableView Willdisplaycell: (UITableViewCell *) cell Forrowatindexpath: (Nsindexpath *) Indexpath;- (void) TableView: (UITableView *) TableView Willdisplayheaderview: (UIView *) View forsection: (nsinteger) Section ns_available_ios (6_0);- (void) TableView: (UITableView *) TableView Willdisplayfooterview: (UIView *) View forsection: (nsinteger) Section ns_available_ios (6_0);- (void) TableView: (UITableView *) TableView Didenddisplayingcell: (UITableViewCell *) cell Forrowatindexpath: (nsindexpath*) Indexpath Ns_available_ios (6_0);- (void) TableView: (UITableView *) TableView Didenddisplayingheaderview: (UIView *) View forsection: (nsinteger) Section ns_available_ios (6_0);- (void) TableView: (UITableView *) TableView Didenddisplayingfooterview: (UIView *) View forsection: (nsinteger) Section Ns_ Available_ios (6_0);
2, set the height
-(CGFloat) TableView: (UITableView *) TableView Heightforrowatindexpath: (Nsindexpath *) Indexpath; -(CGFloat) TableView: (UITableView *) TableView heightforheaderinsection: (nsinteger) section; -(CGFloat) TableView: (UITableView *) TableView heightforfooterinsection: (nsinteger) Section;
3, the budget height (using the method of budget height can quickly achieve tableview preload, if these budget methods are implemented then the upper calculation method will be deferred until the view is about to display, so some more complex logic can be put here budget)
-(CGFloat) TableView: (UITableView *) TableView Estimatedheightforrowatindexpath: (Nsindexpath *) Indexpath Ns_ Available_ios (7_0); -(CGFloat) TableView: (UITableView *) TableView estimatedheightforheaderinsection: (nsinteger) Section Ns_ Available_ios (7_0); -(CGFloat) TableView: (UITableView *) TableView estimatedheightforfooterinsection: (nsinteger) Section Ns_available_ IOS (7_0);
4, custom session of Headerview and Footerview
-(Nullable UIView *) TableView: (UITableView *) TableView viewforheaderinsection: (nsinteger) section; -(Nullable UIView *) TableView: (UITableView *) TableView viewforfooterinsection: (nsinteger) Section;
5, set the right auxiliary button type and click Method
-(Uitableviewcellaccessorytype) TableView: (UITableView *) TableView Accessorytypeforrowwithindexpath: (Nsindexpath * ) Indexpath Ns_deprecated_ios (2_0, 3_0) __tvos_prohibited; -(void) TableView: (UITableView *) TableView Accessorybuttontappedforrowwithindexpath: (Nsindexpath *) Indexpath;
6. Whether Tableviewcell is highlighted when selected
-(BOOL) TableView: (UITableView *) TableView Shouldhighlightrowatindexpath: (Nsindexpath *) Indexpath Ns_available_ IOS (6_0); -(void) TableView: (UITableView *) TableView Didhighlightrowatindexpath: (Nsindexpath *) Indexpath Ns_ Available_ios (6_0); -(void) TableView: (UITableView *) TableView Didunhighlightrowatindexpath: (Nsindexpath *) Indexpath Ns_ Available_ios (6_0);
7. Tableviewcell Selection and Inverse
-(Nullable Nsindexpath *) TableView: (UITableView *) TableView Willselectrowatindexpath: (Nsindexpath *) Indexpath; -(Nullable Nsindexpath *) TableView: (UITableView *) TableView Willdeselectrowatindexpath: (Nsindexpath *) Indexpath Ns_available_ios (3_0); // called after the user changes the selection. -(void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) Indexpath; -(void) TableView: (UITableView *) TableView Diddeselectrowatindexpath: (Nsindexpath *) Indexpath ns_available _ios (3_0);
8. Set the button type of left edit state (delete by default)
-(Uitableviewcelleditingstyle) TableView: (UITableView *) TableView Editingstyleforrowatindexpath: (Nsindexpath *) Indexpath;
9. Set the title of the Delete button that appears on the left slide of the edit state
-(Nullable NSString *) TableView: (UITableView *) TableView Titlefordeleteconfirmationbuttonforrowatindexpath: ( Nsindexpath *) Indexpath Ns_available_ios (3_0) __tvos_prohibited;
10, custom edit state left slide appear button (return type Uitableviewrowaction, click Method is block implementation)
-(Nullable nsarray<uitableviewrowaction *> *) TableView: (UITableView *) TableView Editactionsforrowatindexpath :(Nsindexpath *) Indexpath Ns_available_ios (8_0) __tvos_prohibited;
11. Edit Status Cell left indent switch
-(BOOL) TableView: (UITableView *) TableView Shouldindentwhileeditingrowatindexpath: (Nsindexpath *) Indexpath;
12. Start and end edit a
-(void) TableView: (uitableview*) TableView Willbegineditingrowatindexpath: (Nsindexpath *) Indexpath __ tvos_prohibited; -(void) TableView: (uitableview*) TableView Didendeditingrowatindexpath: (Nsindexpath *) Indexpath __tvos_ prohibited;
13. Moving from one position to another
-(Nsindexpath *) TableView: (UITableView *) TableView Targetindexpathformovefromrowatindexpath: (Nsindexpath *) Sourceindexpath Toproposedindexpath: (Nsindexpath *) Proposeddestinationindexpath;
14, Cell indentation
-(Nsinteger) TableView: (UITableView *) TableView Indentationlevelforrowatindexpath: (Nsindexpath *) Indexpath;
15. Unused methods (to be verified)
//Copy/paste. All three methods must is implemented by the delegate.-(BOOL) TableView: (UITableView *) TableView Shouldshowmenuforrowatindexpath: (Nsindexpath *) Indexpath Ns_available_ios (5_0);-(BOOL) TableView: (UITableView *) TableView canperformaction: (SEL) Action Forrowatindexpath: (Nsindexpath *) Indexpath Withsender: (NullableID) Sender Ns_available_ios (5_0);- (void) TableView: (UITableView *) TableView performaction: (SEL) Action Forrowatindexpath: (Nsindexpath *) Indexpath Withsender :(NullableID) Sender Ns_available_ios (5_0); #ifndef sdk_hide_tide//Focus-(BOOL) TableView: (UITableView *) TableView Canfocusrowatindexpath: (Nsindexpath *) Indexpath Ns_available_ios (9_0);-(BOOL) TableView: (UITableView *) TableView shouldupdatefocusincontext: (Uitableviewfocusupdatecontext *) Context Ns_available_ios (9_0);- (void) TableView: (UITableView *) TableView didupdatefocusincontext: (Uitableviewfocusupdatecontext *) context Withanimationcoordinator: (Uifocusanimationcoordinator *) Coordinator Ns_available_ios (9_0);-(Nullable Nsindexpath *) Indexpathforpreferredfocusedviewintableview: (UITableView *) TableView Ns_available_ios (9_0 );
IOS UITableView Agent Method Summary