猎豆优选

LDCollectionMainViewController.m 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //
  2. // LDCollectionMainViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/5/7.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LDCollectionMainViewController.h"
  9. #import "LDMyCollectionViewController.h"
  10. #import "JDragonTypeButtonView.h"
  11. #import "MLMSegmentHead.h"
  12. #import "MLMSegmentManager.h"
  13. #import "LDHistoryViewController.h"
  14. @interface LDCollectionMainViewController ()<MLMSegmentHeadDelegate,MLMSegmentScrollDelegate>
  15. {
  16. NSInteger _page;
  17. }
  18. @property (nonatomic, strong) MLMSegmentHead *titleView;
  19. @property (nonatomic, strong) MLMSegmentScroll *segScroll;
  20. @end
  21. @implementation LDCollectionMainViewController
  22. - (void)viewWillDisappear:(BOOL)animated {
  23. [super viewWillDisappear:animated];
  24. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
  25. }
  26. - (void)viewDidAppear:(BOOL)animated {
  27. [super viewDidAppear:animated];
  28. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
  29. }
  30. - (void)viewWillAppear:(BOOL)animated {
  31. [super viewWillAppear:animated];
  32. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
  33. }
  34. - (void)viewDidLoad {
  35. [super viewDidLoad];
  36. [self configNavigationBar];
  37. [self creatSwitchView];
  38. }
  39. - (void)creatSwitchView {
  40. self.view.backgroundColor = [UIColor whiteColor];
  41. NSArray *titleArr = @[@"我的收藏",@"浏览记录"];
  42. NSMutableArray *list = [NSMutableArray array];
  43. for (int i = 0; i < 1; i++) {
  44. LDMyCollectionViewController *seg = [[LDMyCollectionViewController alloc] init];
  45. seg.selectedIndex = i;
  46. [list addObject:seg];
  47. }
  48. LDHistoryViewController *history = [[LDHistoryViewController alloc] init];
  49. [list addObject:history];
  50. self.segScroll = [[MLMSegmentScroll alloc] initWithFrame:CGRectMake(0, NavBarHeight+40, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight-40) vcOrViews:list];
  51. self.segScroll.loadAll = YES;
  52. self.titleView = [[MLMSegmentHead alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, 40) titles:titleArr headStyle:SegmentHeadStyleDefault layoutStyle:MLMSegmentLayoutDefault];
  53. self.titleView.headColor = [UIColor clearColor];
  54. self.titleView.bottomLineHeight = 1;
  55. self.titleView.bottomLineColor = [UIColor yhGrayColor];
  56. self.titleView.fontScale = 1;
  57. self.titleView.fontSize = 14;
  58. self.titleView.equalSize = YES;
  59. self.titleView.showIndex = 0;
  60. self.titleView.selectColor = [UIColor YHColorWithHex:0xff442a];
  61. self.titleView.deSelectColor = [UIColor YHColorWithHex:0x666666];
  62. [MLMSegmentManager associateHead:self.titleView withScroll:self.segScroll completion:^{
  63. [self.view addSubview:self.titleView];
  64. [self.view addSubview:self.segScroll];
  65. }];
  66. }
  67. - (void)configNavigationBar {
  68. _page = 1;
  69. [self.navigationBar setNavTitle:@"我的收藏"];
  70. self.navigationBar.backgroundColor = [UIColor changeColor];
  71. self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor];
  72. UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  73. [leftBtn setImage:[UIImage imageNamed:@"back_white"] forState:UIControlStateNormal];
  74. [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  75. [self.navigationBar setCustomLeftButtons:@[leftBtn]];
  76. }
  77. - (void)backAction {
  78. [self.navigationController popViewControllerAnimated:YES];
  79. }
  80. - (void)didReceiveMemoryWarning {
  81. [super didReceiveMemoryWarning];
  82. // Dispose of any resources that can be recreated.
  83. }
  84. /*
  85. #pragma mark - Navigation
  86. // In a storyboard-based application, you will often want to do a little preparation before navigation
  87. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  88. // Get the new view controller using [segue destinationViewController].
  89. // Pass the selected object to the new view controller.
  90. }
  91. */
  92. @end