123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- //
- // JXPagerView+RQExtension.m
- // JSJP
- //
- // Created by 张嵘 on 2021/10/26.
- //
- #import "JXPagerView+RQExtension.h"
- #import <objc/runtime.h>
- static NSString *isMirrorKey = @"isMirrorKey"; //isMirror的key
- @interface JXPagerView (RQExtension)
- @property (nonatomic, weak) id<JXPagerViewDelegate> delegate;
- @end
- @implementation JXPagerView (RQExtension)
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- if (self.isMirror) {
- return 1;
- } else {
- return [self.delegate heightForPinSectionHeaderInPagerView:self];
- }
-
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
- if (self.isMirror) {
- UIView *header = [[UIView alloc] initWithFrame:CGRectZero];
- header.backgroundColor = [UIColor clearColor];
- return header;
- } else {
- return [self.delegate viewForPinSectionHeaderInPagerView:self];
- }
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
- if (self.isMirror) {
- return [self.delegate heightForPinSectionHeaderInPagerView:self];
- } else {
- return 1;
- }
- }
- - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
- if (self.isMirror) {
- return [self.delegate viewForPinSectionHeaderInPagerView:self];
- } else {
- UIView *footer = [[UIView alloc] initWithFrame:CGRectZero];
- footer.backgroundColor = [UIColor clearColor];
- return footer;
- }
- }
- - (void)setIsMirror:(BOOL)isMirror {
- objc_setAssociatedObject(self, &isMirrorKey, @(isMirror), OBJC_ASSOCIATION_ASSIGN);
- }
- - (BOOL)isMirror {
- return [objc_getAssociatedObject(self, &isMirrorKey) boolValue];
- }
- @end
|