口袋优选

KBCommunityViewController.m 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // KBCommunityViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/5/16.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBCommunityViewController.h"
  9. #import "KBCommunityLeftController.h"
  10. #import "KBCommunityRightController.h"
  11. #import "MLMSegmentHead.h"
  12. #import "MLMSegmentManager.h"
  13. @interface KBCommunityViewController ()
  14. {
  15. NSInteger _page;
  16. }
  17. @property (nonatomic, strong) MLMSegmentHead *titleView;
  18. @property (nonatomic, strong) MLMSegmentScroll *segScroll;
  19. @end
  20. @implementation KBCommunityViewController
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. [self configNavigationBar];
  24. [self creatSwitchView];
  25. }
  26. - (void)configNavigationBar{
  27. [self.navigationBar setNavTitle:@"口袋优选"];
  28. self.view.backgroundColor = [UIColor whiteColor];
  29. self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor];
  30. self.navigationBar.backgroundColor = [UIColor changeColor];
  31. }
  32. -(void)viewWillAppear:(BOOL)animated{
  33. [super viewWillAppear:animated];
  34. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
  35. }
  36. -(void)viewDidDisappear:(BOOL)animated{
  37. [super viewDidDisappear:animated];
  38. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
  39. }
  40. -(void)viewDidAppear:(BOOL)animated{
  41. [super viewDidAppear:animated];
  42. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
  43. }
  44. - (void)creatSwitchView {
  45. self.view.backgroundColor = [UIColor whiteColor];
  46. NSArray *titleArr = @[@"优选商品",@"优选素材"];
  47. NSMutableArray *list = [NSMutableArray array];
  48. KBCommunityLeftController *seg = [[KBCommunityLeftController alloc] init];
  49. [list addObject:seg];
  50. KBCommunityRightController *seg2 = [[KBCommunityRightController alloc] init];
  51. [list addObject:seg2];
  52. self.segScroll = [[MLMSegmentScroll alloc] initWithFrame:CGRectMake(0, NavBarHeight+40, SCREEN_WIDTH, ChildTableViewHeight) vcOrViews:list];
  53. self.segScroll.loadAll = YES;
  54. self.titleView = [[MLMSegmentHead alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, 40) titles:titleArr headStyle:SegmentHeadStyleDefault layoutStyle:MLMSegmentLayoutDefault];
  55. self.titleView.headColor = [UIColor clearColor];
  56. self.titleView.bottomLineHeight = 1;
  57. self.titleView.bottomLineColor = [UIColor yhGrayColor];
  58. self.titleView.fontScale = 1;
  59. self.titleView.fontSize = 14;
  60. self.titleView.equalSize = YES;
  61. self.titleView.bottomLineHeight = 0;
  62. self.titleView.showIndex = 0;
  63. self.titleView.selectColor = [UIColor YHColorWithHex:0xff442a];
  64. self.titleView.deSelectColor = [UIColor YHColorWithHex:0x666666];
  65. [MLMSegmentManager associateHead:self.titleView withScroll:self.segScroll completion:^{
  66. [self.view addSubview:self.titleView];
  67. [self.view addSubview:self.segScroll];
  68. }];
  69. }
  70. - (void)didReceiveMemoryWarning {
  71. [super didReceiveMemoryWarning];
  72. // Dispose of any resources that can be recreated.
  73. }
  74. @end