【获取数据】
@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
};
*/