2
This commit is contained in:
@@ -25,16 +25,20 @@
|
||||
#import "JXCategoryTitleView.h"
|
||||
|
||||
static const CGFloat JXTableHeaderViewHeight = 224;
|
||||
static const CGFloat JXheightForHeaderInSection = 50;
|
||||
static const CGFloat JXheightForHeaderInSection = 39;
|
||||
|
||||
@interface KBPayMainVC ()<JXCategoryViewDelegate,JXPagerViewDelegate, JXPagerMainTableViewGestureDelegate>
|
||||
@property (nonatomic, strong) JXPagerView *pagerView;
|
||||
@property (nonatomic, strong) PagingViewTableHeaderView *userHeaderView;
|
||||
@property (nonatomic, strong, readonly) JXCategoryTitleView *categoryView;
|
||||
//@property (nonatomic, strong, readonly) JXCategoryTitleView *categoryView;
|
||||
@property (nonatomic, strong) JXCategoryImageView *myCategoryView;
|
||||
|
||||
@property (nonatomic, assign) BOOL isNeedFooter;
|
||||
@property (nonatomic, assign) BOOL isNeedHeader;
|
||||
- (JXPagerView *)preferredPagingView;
|
||||
@property (nonatomic, strong) NSArray <NSString *> *titles;
|
||||
//@property (nonatomic, strong) NSArray <NSString *> *titles;
|
||||
@property (nonatomic, strong) NSArray *imageNames;
|
||||
|
||||
@property (nonatomic, strong) UIView *naviBGView;
|
||||
@property (nonatomic, strong) UIButton *closeButton; // 当前选中的方案索引
|
||||
|
||||
@@ -46,33 +50,33 @@ static const CGFloat JXheightForHeaderInSection = 50;
|
||||
[super viewDidLoad];
|
||||
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
self.navigationController.navigationBar.translucent = false;
|
||||
self.edgesForExtendedLayout = UIRectEdgeNone;
|
||||
// self.kb_navView.hidden = true;
|
||||
_titles = @[@"VIP", @"SVIP"];
|
||||
// self.navigationController.navigationBar.translucent = false;
|
||||
// self.edgesForExtendedLayout = UIRectEdgeNone;
|
||||
self.imageNames = @[@"VIP_Normal_icon", @"SVIP_Normal_icon"];
|
||||
NSArray *selectedImageNames = @[@"VIP_Selected_icon", @"SVIP_Selected_icon"];
|
||||
|
||||
_userHeaderView = [[PagingViewTableHeaderView alloc] init];
|
||||
self.myCategoryView = [[JXCategoryImageView alloc] initWithFrame:CGRectMake(24, 0, KB_SCREEN_WIDTH - 48, JXheightForHeaderInSection)];
|
||||
self.myCategoryView.backgroundColor = [UIColor redColor];
|
||||
self.myCategoryView.imageInfoArray = self.imageNames;
|
||||
self.myCategoryView.selectedImageInfoArray = selectedImageNames;
|
||||
self.myCategoryView.loadImageBlock = ^(UIImageView *imageView, id info) {
|
||||
NSString *imageName = info;
|
||||
imageView.image = [UIImage imageNamed:imageName];
|
||||
};
|
||||
// self.myCategoryView.imageZoomEnabled = YES;
|
||||
self.myCategoryView.imageCornerRadius = 0;
|
||||
self.myCategoryView.imageSize = CGSizeMake(160, JXheightForHeaderInSection);
|
||||
// JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
|
||||
// lineView.indicatorWidth = 20;
|
||||
// self.myCategoryView.indicators = @[lineView];
|
||||
|
||||
_categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, JXheightForHeaderInSection)];
|
||||
self.categoryView.titles = self.titles;
|
||||
self.categoryView.backgroundColor = [UIColor whiteColor];
|
||||
self.categoryView.delegate = self;
|
||||
self.categoryView.titleSelectedColor = [UIColor colorWithRed:105/255.0 green:144/255.0 blue:239/255.0 alpha:1];
|
||||
self.categoryView.titleColor = [UIColor blackColor];
|
||||
self.categoryView.titleColorGradientEnabled = YES;
|
||||
self.categoryView.titleLabelZoomEnabled = YES;
|
||||
self.categoryView.contentScrollViewClickTransitionAnimationEnabled = NO;
|
||||
|
||||
JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
|
||||
lineView.indicatorColor = [UIColor colorWithRed:105/255.0 green:144/255.0 blue:239/255.0 alpha:1];
|
||||
lineView.indicatorWidth = 30;
|
||||
self.categoryView.indicators = @[lineView];
|
||||
|
||||
_pagerView = [self preferredPagingView];
|
||||
self.pagerView.mainTableView.gestureDelegate = self;
|
||||
[self.view addSubview:self.pagerView];
|
||||
|
||||
self.categoryView.listContainer = (id<JXCategoryViewListContainer>)self.pagerView.listContainerView;
|
||||
self.myCategoryView.listContainer = (id<JXCategoryViewListContainer>)self.pagerView.listContainerView;
|
||||
|
||||
//导航栏隐藏的情况,处理扣边返回,下面的代码要加上
|
||||
// [self.pagerView.listContainerView.scrollView.panGestureRecognizer requireGestureRecognizerToFail:self.navigationController.interactivePopGestureRecognizer];
|
||||
@@ -94,11 +98,6 @@ static const CGFloat JXheightForHeaderInSection = 50;
|
||||
naviTitleLabel.frame = CGRectMake(0, KB_STATUSBAR_HEIGHT, self.view.bounds.size.width, 44);
|
||||
[self.naviBGView addSubview:naviTitleLabel];
|
||||
|
||||
// UIButton *back = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
// [back setTitle:@"返回" forState:UIControlStateNormal];
|
||||
// back.frame = CGRectMake(12, KB_STATUSBAR_HEIGHT, 44, 44);
|
||||
// [back addTarget:self action:@selector(backButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
|
||||
// [self.naviBGView addSubview:back];
|
||||
|
||||
[self.view addSubview:self.closeButton];
|
||||
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -106,12 +105,14 @@ static const CGFloat JXheightForHeaderInSection = 50;
|
||||
make.left.equalTo(self.view).offset(15);
|
||||
make.width.height.mas_equalTo(36);
|
||||
}];
|
||||
|
||||
self.pagerView.mainTableView.backgroundColor = [UIColor colorWithHex:0xF6F7FB];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
|
||||
self.navigationController.interactivePopGestureRecognizer.enabled = (self.categoryView.selectedIndex == 0);
|
||||
self.navigationController.interactivePopGestureRecognizer.enabled = (self.myCategoryView.selectedIndex == 0);
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
@@ -145,12 +146,12 @@ static const CGFloat JXheightForHeaderInSection = 50;
|
||||
}
|
||||
|
||||
- (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
||||
return self.categoryView;
|
||||
return self.myCategoryView;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
|
||||
//和categoryView的item数量一致
|
||||
return self.categoryView.titles.count;
|
||||
return 2;
|
||||
}
|
||||
|
||||
- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
|
||||
@@ -174,7 +175,7 @@ static const CGFloat JXheightForHeaderInSection = 50;
|
||||
|
||||
- (BOOL)mainTableViewGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
|
||||
//禁止categoryView左右滑动的时候,上下和左右都可以滚动
|
||||
if (otherGestureRecognizer == self.categoryView.collectionView.panGestureRecognizer) {
|
||||
if (otherGestureRecognizer == self.myCategoryView.collectionView.panGestureRecognizer) {
|
||||
return NO;
|
||||
}
|
||||
return [gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]] && [otherGestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]];
|
||||
|
||||
Reference in New Issue
Block a user