123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- //
- // KDPLiveDataViewController.m
- // KuDianProject
- //
- // Created by admin on 2019/7/4.
- // Copyright © 2019 KDP. All rights reserved.
- //
- #import "KDPLiveDataViewController.h"
- #import "XLPageViewController.h"
- #import "KDPLiveLeftViewController.h"
- #import "KDPLiveRightViewController.h"
- @interface KDPLiveDataViewController ()<XLPageViewControllerDelegate,XLPageViewControllerDataSrouce>
- @property (nonatomic, strong) XLPageViewController *pageVC;
- @end
- @implementation KDPLiveDataViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- [self setContentView];
- }
- - (void)setContentView{
- self.navBar.hidden = YES;
- UIView *topBackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, KDNavBarHeight)];
- [topBackView setGradientBackgroundWithColors:@[[UIColor colorWithHex:0xFF235F],[UIColor colorWithHex:0xFF7676]] locations:@[@0,@1] startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
- [self.view addSubview:topBackView];
- [self addChildViewController:self.pageVC];
- [self.view addSubview:self.pageVC.view];
- }
- - (XLPageViewController *)pageVC{
- if (!_pageVC) {
- XLPageViewControllerConfig *config = [[XLPageViewControllerConfig alloc] init];
- //标题间距
- config.titleSpace = 100;
- config.titleViewStyle = XLPageTitleViewStyleBasic;
- //标题高度
- config.titleViewHeight = 40;
- //标题选中颜色
- config.titleSelectedColor = [UIColor whiteColor];
- //标题选中字体
- config.titleSelectedFont = [UIFont fontWithName:@"PingFangSC-Semibold" size: 16];
- //标题正常颜色
- config.titleNormalColor = [UIColor whiteColor];
- //标题正常字体
- config.titleNormalFont = [UIFont fontWithName:@"PingFangSC-Regular" size: 16];
- config.titleViewInset = UIEdgeInsetsMake(0, 73, 0, 73);
- //阴影颜色
- config.shadowLineColor = [UIColor colorWithHex:0xFFB444];
- //阴影宽度
- config.shadowLineWidth = 15;
- //阴影末端是直角
- config.shadowLineCap = XLPageShadowLineCapSquare;
- config.showTitleInNavigationBar = NO;
- //分割线颜色
- config.separatorLineHidden = YES;
- config.shadowLineHeight = 2;
- config.shadowLineAnimationType = XLPageShadowLineAnimationTypePan;
- config.separatorLineBottomMargin = 5;
- _pageVC = [[XLPageViewController alloc] initWithConfig:config];
- _pageVC.view.bounds = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-KDTabBarHeight+1);
- _pageVC.delegate = self;
- _pageVC.dataSource = self;
- }
- return _pageVC;
- }
- #pragma mark - XLPageViewController datasource and delegate
- - (NSInteger)pageViewControllerNumberOfPage{
- NSArray *array = @[@"基础数据",@"商品统计"];
- return array.count;
- }
- - (NSString *)pageViewController:(XLPageViewController *)pageViewController titleForIndex:(NSInteger)index{
- NSArray *array = @[@"基础数据",@"商品统计"];
- return array[index];
- }
- - (void)pageViewController:(XLPageViewController *)pageViewController didSelectedAtIndex:(NSInteger)index{
- NSLog(@"%ld",index);
- }
- - (UIViewController *)pageViewController:(XLPageViewController *)pageViewController viewControllerForIndex:(NSInteger)index{
- if (index == 0) {
- KDPLiveLeftViewController *leftVC = [[KDPLiveLeftViewController alloc] init];
- return leftVC;
- } else if(index == 1) {
- KDPLiveRightViewController *rightVC = [[KDPLiveRightViewController alloc] init];
- return rightVC;
- }
- UIViewController *contentVC = [[UIViewController alloc] init];
- return contentVC;
- }
- @end
|