ios – UITableView的委托和数据源方法

ios – UITableView的委托和数据源方法,第1张

概述任何人都可以列出UITableView的委托方法数据源方法? UITableView的代理和数据源方法是否相同? //_______________________________________________________________________________________________________________// this represents the displ 任何人都可以列出UItableVIEw的委托方法和数据源方法?

UItableVIEw的代理和数据源方法是否相同?

解决方法
//_______________________________________________________________________________________________________________// this represents the display and behavIoUr of the cells.@protocol UItableVIEwDelegate<NSObject,uiscrollviewdelegate>@optional// display customization- (voID)tableVIEw:(UItableVIEw *)tableVIEw willdisplayCell:(UItableVIEwCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;// Variable height support- (CGfloat)tableVIEw:(UItableVIEw *)tableVIEw heightForRowAtIndexPath:(NSIndexPath *)indexPath;- (CGfloat)tableVIEw:(UItableVIEw *)tableVIEw heightForheaderInSection:(NSInteger)section;- (CGfloat)tableVIEw:(UItableVIEw *)tableVIEw heightForFooterInSection:(NSInteger)section;// Section header & footer information. VIEws are preferred over Title should you decIDe to provIDe both- (UIVIEw *)tableVIEw:(UItableVIEw *)tableVIEw vIEwForheaderInSection:(NSInteger)section;   // custom vIEw for header. will be adjusted to default or specifIEd header height- (UIVIEw *)tableVIEw:(UItableVIEw *)tableVIEw vIEwForFooterInSection:(NSInteger)section;   // custom vIEw for footer. will be adjusted to default or specifIEd footer height// AccessorIEs (disclosures). - (UItableVIEwCellAccessoryType)tableVIEw:(UItableVIEw *)tableVIEw accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0);- (voID)tableVIEw:(UItableVIEw *)tableVIEw accessorybuttonTappedForRowWithIndexPath:(NSIndexPath *)indexPath;// Selection// Called before the user changes the selection. Return a new indexPath,or nil,to change the proposed selection.- (NSIndexPath *)tableVIEw:(UItableVIEw *)tableVIEw willSelectRowAtIndexPath:(NSIndexPath *)indexPath;- (NSIndexPath *)tableVIEw:(UItableVIEw *)tableVIEw willdeselectRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);// Called after the user changes the selection.- (voID)tableVIEw:(UItableVIEw *)tableVIEw dIDSelectRowAtIndexPath:(NSIndexPath *)indexPath;- (voID)tableVIEw:(UItableVIEw *)tableVIEw dIDdeselectRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);// Editing// Allows customization of the editingStyle for a particular cell located at 'indexPath'. If not implemented,all editable cells will have UItableVIEwCellEditingStyleDelete set for them when the table has editing property set to YES.- (UItableVIEwCellEditingStyle)tableVIEw:(UItableVIEw *)tableVIEw editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;- (Nsstring *)tableVIEw:(UItableVIEw *)tableVIEw TitleForDeleteConfirmationbuttonForRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);// Controls whether the background is indented while editing.  If not implemented,the default is YES.  This is unrelated to the indentation level below.  This method only applIEs to grouped style table vIEws.- (BOol)tableVIEw:(UItableVIEw *)tableVIEw shouldindentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath;// The willBegin/dIDEnd methods are called whenever the 'editing' property is automatically changed by the table (allowing insert/delete/move). This is done by a swipe activating a single row- (voID)tableVIEw:(UItableVIEw*)tableVIEw willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath;- (voID)tableVIEw:(UItableVIEw*)tableVIEw dIDEndEditingRowAtIndexPath:(NSIndexPath *)indexPath;// Moving/reordering// Allows customization of the target row for a particular row as it is being moved/reordered- (NSIndexPath *)tableVIEw:(UItableVIEw *)tableVIEw targetIndexPathForMoveFromrowAtIndexPath:(NSIndexPath *)sourceIndexPath toproposedindexPath:(NSIndexPath *)proposedDestinationIndexPath;               // Indentation- (NSInteger)tableVIEw:(UItableVIEw *)tableVIEw indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath; // return 'depth' of row for hIErarchIEs@end//_______________________________________________________________________________________________________________    // this protocol represents the data model object. as such,it supplIEs no information about appearance (including the cells)@protocol UItableVIEwDataSource<NSObject>@required- (NSInteger)tableVIEw:(UItableVIEw *)tableVIEw numberOfRowsInSection:(NSInteger)section;// Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIDentifIEr and querying for available reusable cells with dequeueReusableCellWithIDentifIEr:// Cell gets varIoUs attributes set automatically based on table (separators) and data source (accessory vIEws,editing controls)- (UItableVIEwCell *)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath;@optional- (NSInteger)numberOfSectionsIntableVIEw:(UItableVIEw *)tableVIEw;              // Default is 1 if not implemented- (Nsstring *)tableVIEw:(UItableVIEw *)tableVIEw TitleForheaderInSection:(NSInteger)section;    // fixed Font style. use custom vIEw (UILabel) if you want something different- (Nsstring *)tableVIEw:(UItableVIEw *)tableVIEw TitleForFooterInSection:(NSInteger)section;// Editing// IndivIDual rows can opt out of having the -editing property set for them. If not implemented,all rows are assumed to be editable.- (BOol)tableVIEw:(UItableVIEw *)tableVIEw canEditRowAtIndexPath:(NSIndexPath *)indexPath;// Moving/reordering// Allows the reorder accessory vIEw to optionally be shown for a particular row. By default,the reorder control will be shown only if the datasource implements -tableVIEw:moveRowAtIndexPath:toIndexPath:- (BOol)tableVIEw:(UItableVIEw *)tableVIEw canMoveRowAtIndexPath:(NSIndexPath *)indexPath;// Index- (NSArray *)sectionIndexTitlesFortableVIEw:(UItableVIEw *)tableVIEw;                                                    // return List of section Titles to display in section index vIEw (e.g. "ABCD...Z#")- (NSInteger)tableVIEw:(UItableVIEw *)tableVIEw sectionForSectionIndexTitle:(Nsstring *)Title atIndex:(NSInteger)index;  // tell table which section corresponds to section Title/index (e.g. "B",1))// Data manipulation - insert and delete support// After a row has the minus or plus button invoked (based on the UItableVIEwCellEditingStyle for the cell),the dataSource must commit the change- (voID)tableVIEw:(UItableVIEw *)tableVIEw commitEditingStyle:(UItableVIEwCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath;// Data manipulation - reorder / moving support- (voID)tableVIEw:(UItableVIEw *)tableVIEw moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath;@end
总结

以上是内存溢出为你收集整理的ios – UITableView的委托和数据源方法全部内容,希望文章能够帮你解决ios – UITableView的委托和数据源方法所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1095805.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存