From b504a48a309880a85741cced8676b425e34c200e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=85=86=E7=A5=A5?= <393727164@qq.com> Date: Wed, 4 Nov 2020 21:57:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20-willDisplayFooterView=20?= =?UTF-8?q?=E5=92=8C=20-didEndDisplayingFooterView=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZXTableView.podspec | 2 +- ZXTableView/ZXTableView.h | 4 ++++ ZXTableView/ZXTableView.m | 18 +++++++++++++++++- .../ZXTableViewDemo/ZXTableView/ZXTableView.h | 4 ++++ .../ZXTableViewDemo/ZXTableView/ZXTableView.m | 18 +++++++++++++++++- 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/ZXTableView.podspec b/ZXTableView.podspec index 2c28f46..8b9801e 100644 --- a/ZXTableView.podspec +++ b/ZXTableView.podspec @@ -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' diff --git a/ZXTableView/ZXTableView.h b/ZXTableView/ZXTableView.h index 7179f10..6e27ef5 100644 --- a/ZXTableView/ZXTableView.h +++ b/ZXTableView/ZXTableView.h @@ -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缩放事件 diff --git a/ZXTableView/ZXTableView.m b/ZXTableView/ZXTableView.m index 13130c3..8f188d5 100644 --- a/ZXTableView/ZXTableView.m +++ b/ZXTableView/ZXTableView.m @@ -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:)]){ diff --git a/ZXTableViewDemo/ZXTableViewDemo/ZXTableView/ZXTableView.h b/ZXTableViewDemo/ZXTableViewDemo/ZXTableView/ZXTableView.h index 7179f10..6e27ef5 100644 --- a/ZXTableViewDemo/ZXTableViewDemo/ZXTableView/ZXTableView.h +++ b/ZXTableViewDemo/ZXTableViewDemo/ZXTableView/ZXTableView.h @@ -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缩放事件 diff --git a/ZXTableViewDemo/ZXTableViewDemo/ZXTableView/ZXTableView.m b/ZXTableViewDemo/ZXTableViewDemo/ZXTableView/ZXTableView.m index 13130c3..8f188d5 100644 --- a/ZXTableViewDemo/ZXTableViewDemo/ZXTableView/ZXTableView.m +++ b/ZXTableViewDemo/ZXTableViewDemo/ZXTableView/ZXTableView.m @@ -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:)]){