dkahgld

ZBMonthOrderVC.m 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. //
  2. // ZBMonthOrderVC.m
  3. // ZBProject
  4. //
  5. // Created by 学丽 on 2019/4/9.
  6. // Copyright © 2019 ZB. All rights reserved.
  7. //
  8. #import "ZBMonthOrderVC.h"
  9. #import "ZBEstimatedViewController.h"
  10. @interface ZBMonthOrderVC ()<UIScrollViewDelegate,MLMSegmentHeadDelegate,MLMSegmentScrollDelegate>
  11. {
  12. NSString *typs;
  13. }
  14. @property (nonatomic, strong) UIScrollView *scrollView;
  15. @property (nonatomic, strong)MLMSegmentHead *titleView;
  16. @property (nonatomic, strong) MLMSegmentScroll *segScroll;
  17. @property (nonatomic, assign) NSInteger currentIndex;
  18. @property (nonatomic, strong) NSArray *childVCArr;
  19. @property(nonatomic,strong)UIButton *dateSeleteBtn;
  20. @property (nonatomic, strong) LDCalendarView *calendarView ;
  21. @property (nonatomic, strong) CCAlertShowView *alertShowView;
  22. @end
  23. @implementation ZBMonthOrderVC
  24. - (void)viewDidLoad {
  25. [super viewDidLoad];
  26. [self.view bringSubviewToFront:self.navBar];
  27. typs = @"1";
  28. [self initNavs];
  29. }
  30. -(void)initNavs
  31. {
  32. [self configChildViewController];
  33. self.view.backgroundColor=[UIColor lineColor];
  34. [self.navBar setCustomRightButtons:@[self.dateSeleteBtn]];
  35. UIButton *returnBtn =[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 30, 20)];
  36. [returnBtn addTarget:self action:@selector(returnClickBtn) forControlEvents:UIControlEventTouchUpInside];
  37. [returnBtn setImage:[UIImage imageNamed:@"return_white"] forState:UIControlStateNormal];
  38. returnBtn.adjustsImageWhenHighlighted = NO;
  39. [self.navBar setCustomLeftButtons:@[returnBtn]];
  40. [self creatSwitchView];
  41. }
  42. - (void)creatSwitchView {
  43. self.view.backgroundColor = [UIColor backgroudColor];
  44. self.titleView = [[MLMSegmentHead alloc] initWithFrame:CGRectMake(50, KStatusBarHeight, SCREEN_WIDTH-100, NavBarHeight-KStatusBarHeight) titles:@[@"预估收益",@"结算收益"] headStyle:SegmentHeadStyleLine layoutStyle:MLMSegmentLayoutCenter];
  45. self.titleView.headColor = [UIColor clearColor];
  46. self.titleView.bottomLineHeight = 1;
  47. self.titleView.bottomLineColor = [UIColor whiteColor];
  48. self.titleView.fontScale = 1;
  49. self.titleView.lineScale = .4;
  50. self.titleView.fontSize = 14;
  51. self.titleView.fontScale=1.1;
  52. self.titleView.bottomLineHeight=0;
  53. self.titleView.equalSize = YES;
  54. // self.titleView.delegate=self;
  55. self.titleView.showIndex = 0;
  56. self.titleView.selectColor = [UIColor whiteColor];
  57. self.titleView.deSelectColor = [UIColor whiteColor];
  58. self.titleView.lineColor = [UIColor whiteColor];
  59. self.segScroll = [[MLMSegmentScroll alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight) vcOrViews:self.childVCArr];
  60. self.segScroll.segDelegate=self;
  61. self.segScroll.loadAll = YES;
  62. [MLMSegmentManager associateHead:self.titleView withScroll:self.segScroll completion:^{
  63. [self.view addSubview:self.segScroll];
  64. }];
  65. [self.navBar addSubview:self.titleView];
  66. self.titleView.centerX = self.navBar.centerX;
  67. }
  68. -(void)scrollEndIndex:(NSInteger)index
  69. {
  70. self.currentIndex = index;
  71. }
  72. - (void)configChildViewController {
  73. ZBEstimatedViewController *ticket = [[ZBEstimatedViewController alloc] init];
  74. ticket.types=@"1";
  75. ticket.view.y = NavBarHeight;
  76. ZBEstimatedViewController *goods = [[ZBEstimatedViewController alloc] init];
  77. goods.types=@"2";
  78. goods.view.y = NavBarHeight;
  79. self.currentIndex = 0;
  80. self.childVCArr = @[ticket,goods];
  81. }
  82. -(void)viewWillAppear:(BOOL)animated
  83. {
  84. [super viewWillAppear:animated];
  85. self.navBar.navTitleLabel.text=@"";
  86. }
  87. -(void)returnClickBtn
  88. {
  89. [self.navigationController popViewControllerAnimated:YES];
  90. }
  91. #pragma mark --------------------- MLMSegmentHeadDelegate ---------
  92. - (void)didSelectedIndex:(NSInteger)index {
  93. self.currentIndex = index;
  94. // [self transitionFromViewController:self.childVCArr[self.currentIndex] toViewController:self.childVCArr[index] duration:0.3 options:UIViewAnimationOptionCurveEaseOut animations:nil completion:^(BOOL finished) {
  95. //
  96. // }];
  97. }
  98. - (UIButton *)dateSeleteBtn {
  99. if (!_dateSeleteBtn) {
  100. _dateSeleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  101. _dateSeleteBtn.frame=CGRectMake(0, 0, 40, 50);
  102. [_dateSeleteBtn setImage:[UIImage imageNamed:@"calendar"] forState:UIControlStateNormal];
  103. [_dateSeleteBtn addTarget:self action:@selector(clickAction) forControlEvents:UIControlEventTouchUpInside];
  104. _dateSeleteBtn.adjustsImageWhenHighlighted=NO;
  105. }
  106. return _dateSeleteBtn;
  107. }
  108. -(void)clickAction
  109. {
  110. ZBIncomeViewController *incomV =[[ZBIncomeViewController alloc]init];
  111. incomV.isDay =1;//按天
  112. incomV.yearMonthDay=[PublicFunction getCurrentDay];
  113. if (self.currentIndex == 0) {
  114. incomV.type=@"1";//1:预估收入 2:结算收入
  115. }else{
  116. incomV.type=@"2";//1:预估收入 2:结算收入
  117. }
  118. incomV.isShow=@"1";
  119. [self.navigationController pushViewController:incomV animated:YES];
  120. }
  121. #pragma mark - ITDatePickerControllerDelegate
  122. - (void)datePickerController:(ITDatePickerController *)datePickerController didSelectedDate:(NSDate *)date dateString:(NSString *)dateString {
  123. NSLog(@"%@",dateString);
  124. }
  125. @end