【UIKit-110-2】#import <UIKit/UITableView.h>获取数据与滚动


【获取数据】

@interface UITableView : UIScrollView <NSCoding>



- (void)reloadData;                 // 更新表内容

- (void)reloadSectionIndexTitlesNS_AVAILABLE_IOS(3_0);  // 插入或者删除,更新部分表,而不是全部。



// Info


- (NSInteger)numberOfSections;

- (NSInteger)numberOfRowsInSection:(NSInteger)section;


- (CGRect)rectForSection:(NSInteger)section;                                   // includes header, footer and all rows

- (CGRect)rectForHeaderInSection:(NSInteger)section;

- (CGRect)rectForFooterInSection:(NSInteger)section;

- (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath;



- (NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point;                        // point(在tableView上)判断在那一行

- (NSIndexPath *)indexPathForCell:(UITableViewCell *)cell;                     // 获取cell所在的行

- (NSArray *)indexPathsForRowsInRect:(CGRect)rect;                             // 获取rect范围内的cell行数组



- (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath;            // 获取指定行的cell,

- (NSArray *)visibleCells;// 可以看见的 所以cell

- (NSArray *)indexPathsForVisibleRows;// 可以看见的cell的位置

- (UITableViewHeaderFooterView *)headerViewForSection:(NSInteger)sectionNS_AVAILABLE_IOS(6_0);// 获取headView

- (UITableViewHeaderFooterView *)footerViewForSection:(NSInteger)sectionNS_AVAILABLE_IOS(6_0);// 获取footView




【滚动位置】

- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated;// 滚动到某个位置

- (void)scrollToNearestSelectedRowAtScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated;// 滚动到最近选择的位置    

    [theTableView scrollToRowAtIndexPath:path atScrollPosition:UITableViewScrollPositionTop animated:YES];
    
    [theTableView scrollToNearestSelectedRowAtScrollPosition:UITableViewScrollPositionTop animated:YES];

    /*
     typedef NS_ENUM(NSInteger, UITableViewScrollPosition) {
     UITableViewScrollPositionNone,
     UITableViewScrollPositionTop,
     UITableViewScrollPositionMiddle,
     UITableViewScrollPositionBottom
     };
     */





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值