《省钱达人》与《猎豆优选》UI相同版。域名tbk

DRMonthMainViewController.m 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //
  2. // DRMonthMainViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/5/28.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "DRMonthMainViewController.h"
  9. #import "MLMSegmentHead.h"
  10. #import "MLMSegmentManager.h"
  11. #import "DRChildMonthViewController.h"
  12. #import "DRMonthShowTipView.h"//
  13. @interface DRMonthMainViewController ()
  14. @property (nonatomic, strong) MLMSegmentHead *titleView;
  15. @property (nonatomic, strong) MLMSegmentScroll *segScroll;
  16. @property (nonatomic, strong) NSMutableArray *vcList;
  17. @property (nonatomic, strong) DRMonthShowTipView *monthShowTipView;
  18. @end
  19. @implementation DRMonthMainViewController
  20. - (void)viewDidLoad {
  21. [super viewDidLoad];
  22. [self configNavigationBar];
  23. [self creatChildViewController];
  24. }
  25. -(void)viewWillAppear:(BOOL)animated{
  26. [super viewWillAppear:animated];
  27. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
  28. }
  29. - (void)configNavigationBar {
  30. self.view.backgroundColor = [UIColor whiteColor];
  31. if (self.type==0) {
  32. [self.navigationBar setNavTitle:@"预估明细"];
  33. }else{
  34. [self.navigationBar setNavTitle:@"结算明细"];
  35. }
  36. self.monthShowTipView.type=self.type;
  37. self.navigationBar.backgroundColor = [UIColor changeColor];
  38. self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor];
  39. UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  40. [leftBtn setImage:[UIImage imageNamed:@"back_white"] forState:UIControlStateNormal];
  41. [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  42. [self.navigationBar setCustomLeftButtons:@[leftBtn]];
  43. UIButton *rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  44. [rightBtn setImage:[UIImage imageNamed:@"helpmonth"] forState:UIControlStateNormal];
  45. [rightBtn addTarget:self action:@selector(rightAction) forControlEvents:UIControlEventTouchUpInside];
  46. [self.navigationBar setCustomRightButtons:@[rightBtn]];
  47. [[UIApplication sharedApplication].keyWindow addSubview:self.monthShowTipView];
  48. }
  49. - (void)backAction {
  50. [self.navigationController popViewControllerAnimated:YES];
  51. }
  52. -(void)rightAction{
  53. self.monthShowTipView.hidden=NO;
  54. }
  55. - (void)creatChildViewController {
  56. NSArray *titleArr = @[@"本月",@"上月"];
  57. for (int i = 0; i < titleArr.count; i++) {
  58. DRChildMonthViewController *child = [[DRChildMonthViewController alloc] init];
  59. child.isThisMonth = (i==0?1:0);
  60. child.type = self.type;
  61. [self.vcList addObject:child];
  62. }
  63. self.segScroll = [[MLMSegmentScroll alloc] initWithFrame:CGRectMake(0, NavBarHeight+40, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight-40) vcOrViews:self.vcList];
  64. self.titleView = [[MLMSegmentHead alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, 40) titles:titleArr headStyle:SegmentHeadStyleDefault layoutStyle:MLMSegmentLayoutDefault];
  65. self.titleView.headColor = [UIColor whiteColor];
  66. self.titleView.bottomLineHeight = 1;
  67. self.titleView.bottomLineColor = [UIColor yhGrayColor];
  68. self.titleView.fontScale = 1;
  69. self.titleView.fontSize = 14;
  70. self.titleView.equalSize = YES;
  71. self.titleView.showIndex = (self.isThisMonth==0?1:0);
  72. self.titleView.selectColor = [UIColor YHColorWithHex:0xff442a];
  73. self.titleView.deSelectColor = [UIColor YHColorWithHex:0x666666];
  74. [MLMSegmentManager associateHead:self.titleView withScroll:self.segScroll completion:^{
  75. [self.view addSubview:self.titleView];
  76. [self.view addSubview:self.segScroll];
  77. }];
  78. }
  79. #pragma mark ---- layzer
  80. - (NSMutableArray *)vcList {
  81. if (!_vcList) {
  82. _vcList = [NSMutableArray array];
  83. }
  84. return _vcList;
  85. }
  86. -(DRMonthShowTipView *)monthShowTipView{
  87. if (!_monthShowTipView) {
  88. _monthShowTipView=[[[NSBundle mainBundle] loadNibNamed:@"DRMonthShowTipView" owner:self options:nil] lastObject];
  89. _monthShowTipView.frame=CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
  90. _monthShowTipView.hidden=YES;
  91. }
  92. return _monthShowTipView;
  93. }
  94. @end