Skip to content

Commit

Permalink
新增 -willDisplayFooterView 和 -didEndDisplayingFooterView回调
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileZXLee committed Nov 4, 2020
1 parent f0c3e64 commit b504a48
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ZXTableView.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'ZXTableView'
s.version = '1.1.1'
s.version = '1.1.2'
s.summary = '快速构建TableView'
s.homepage = 'https://github.com/SmileZXLee/ZXTableView'
s.license = 'MIT'
Expand Down
4 changes: 4 additions & 0 deletions ZXTableView/ZXTableView.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) void (^zx_willDisplayHeaderView)(NSInteger section,id headerView);
///headerView已经展示完毕,把id改成对应类名即可无需强制转换
@property (nonatomic, copy) void (^zx_didEndDisplayingHeaderView)(NSInteger section,id headerView);
///footerView将要展示,把id改成对应类名即可无需强制转换
@property (nonatomic, copy) void (^zx_willDisplayFooterView)(NSInteger section,id footerView);
///footerView已经展示完毕,把id改成对应类名即可无需强制转换
@property (nonatomic, copy) void (^zx_didEndDisplayingFooterView)(NSInteger section,id footerView);
///scrollView滚动事件
@property (nonatomic, copy) void (^zx_scrollViewDidScroll)(UIScrollView *scrollView);
///scrollView缩放事件
Expand Down
18 changes: 17 additions & 1 deletion ZXTableView/ZXTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,29 @@ -(void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view f
}

- (void)tableView:(UITableView *)tableView didEndDisplayingHeaderView:(UIView *)view forSection:(NSInteger)section{
if([self.zxDelegate respondsToSelector:@selector(tableView:willDisplayHeaderView:forSection:)]){
if([self.zxDelegate respondsToSelector:@selector(tableView:didEndDisplayingHeaderView:forSection:)]){
[self.zxDelegate tableView:tableView didEndDisplayingHeaderView:view forSection:section];
}else{
!self.zx_didEndDisplayingHeaderView ? : self.zx_didEndDisplayingHeaderView(section,view);
}
}

- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section{
if([self.zxDelegate respondsToSelector:@selector(tableView:willDisplayFooterView:forSection:)]){
[self.zxDelegate tableView:tableView willDisplayFooterView:view forSection:section];
}else{
!self.zx_willDisplayFooterView ? : self.zx_willDisplayFooterView(section,view);
}
}

- (void)tableView:(UITableView *)tableView didEndDisplayingFooterView:(UIView *)view forSection:(NSInteger)section{
if([self.zxDelegate respondsToSelector:@selector(tableView:didEndDisplayingFooterView:forSection:)]){
[self.zxDelegate tableView:tableView didEndDisplayingFooterView:view forSection:section];
}else{
!self.zx_didEndDisplayingFooterView ? : self.zx_didEndDisplayingFooterView(section,view);
}
}

#pragma mark - scrollView相关代理
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
if([self.zxDelegate respondsToSelector:@selector(scrollViewDidScroll:)]){
Expand Down
4 changes: 4 additions & 0 deletions ZXTableViewDemo/ZXTableViewDemo/ZXTableView/ZXTableView.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) void (^zx_willDisplayHeaderView)(NSInteger section,id headerView);
///headerView已经展示完毕,把id改成对应类名即可无需强制转换
@property (nonatomic, copy) void (^zx_didEndDisplayingHeaderView)(NSInteger section,id headerView);
///footerView将要展示,把id改成对应类名即可无需强制转换
@property (nonatomic, copy) void (^zx_willDisplayFooterView)(NSInteger section,id footerView);
///footerView已经展示完毕,把id改成对应类名即可无需强制转换
@property (nonatomic, copy) void (^zx_didEndDisplayingFooterView)(NSInteger section,id footerView);
///scrollView滚动事件
@property (nonatomic, copy) void (^zx_scrollViewDidScroll)(UIScrollView *scrollView);
///scrollView缩放事件
Expand Down
18 changes: 17 additions & 1 deletion ZXTableViewDemo/ZXTableViewDemo/ZXTableView/ZXTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,29 @@ -(void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view f
}

- (void)tableView:(UITableView *)tableView didEndDisplayingHeaderView:(UIView *)view forSection:(NSInteger)section{
if([self.zxDelegate respondsToSelector:@selector(tableView:willDisplayHeaderView:forSection:)]){
if([self.zxDelegate respondsToSelector:@selector(tableView:didEndDisplayingHeaderView:forSection:)]){
[self.zxDelegate tableView:tableView didEndDisplayingHeaderView:view forSection:section];
}else{
!self.zx_didEndDisplayingHeaderView ? : self.zx_didEndDisplayingHeaderView(section,view);
}
}

- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section{
if([self.zxDelegate respondsToSelector:@selector(tableView:willDisplayFooterView:forSection:)]){
[self.zxDelegate tableView:tableView willDisplayFooterView:view forSection:section];
}else{
!self.zx_willDisplayFooterView ? : self.zx_willDisplayFooterView(section,view);
}
}

- (void)tableView:(UITableView *)tableView didEndDisplayingFooterView:(UIView *)view forSection:(NSInteger)section{
if([self.zxDelegate respondsToSelector:@selector(tableView:didEndDisplayingFooterView:forSection:)]){
[self.zxDelegate tableView:tableView didEndDisplayingFooterView:view forSection:section];
}else{
!self.zx_didEndDisplayingFooterView ? : self.zx_didEndDisplayingFooterView(section,view);
}
}

#pragma mark - scrollView相关代理
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
if([self.zxDelegate respondsToSelector:@selector(scrollViewDidScroll:)]){
Expand Down

0 comments on commit b504a48

Please sign in to comment.