MyattentionViewController.m 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //
  2. // MyattentionViewController.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/12/8.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "MyattentionViewController.h"
  9. #import "ZJSliderView.h"
  10. #import "WholeViewController.h"
  11. #import "AchievementsViewController.h"
  12. #import "DemandViewController.h"
  13. #import "ExpertViewController.h"
  14. #import "PolicyViewController.h"
  15. @interface MyattentionViewController (){
  16. WholeViewController *wholevc;
  17. AchievementsViewController *achievementsvc;
  18. DemandViewController *Demandvc;
  19. ExpertViewController *expertvc;
  20. PolicyViewController *policyvc;
  21. }
  22. @end
  23. @implementation MyattentionViewController
  24. - (void)viewDidLoad {
  25. [super viewDidLoad];
  26. [self setNavTitle:@"我的关注"];
  27. // 创建分段控制器
  28. [self createSliderView];
  29. // Do any additional setup after loading the view.
  30. }
  31. #pragma mark - 创建分段控制器
  32. - (void)createSliderView {
  33. self.automaticallyAdjustsScrollViewInsets = NO;
  34. UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(0.0, NavHeader, SCREEN_WIDTH, 0.8)];
  35. line.backgroundColor = NewLineGrayColor;
  36. [self.view addSubview:line];
  37. ZJSliderView *slider = [[ZJSliderView alloc] initWithFrame:CGRectMake(0.0f,NavHeader, SCREEN_WIDTH, SCREEN_HEIGHT-NavHeader)];
  38. __weak typeof(self) weakSelf = self;
  39. [slider setNewZJSlider:^(int index) {
  40. [weakSelf autoDownRefresh:index];
  41. }];
  42. wholevc = [[WholeViewController alloc] init];
  43. wholevc.title = @"成果";
  44. achievementsvc = [[AchievementsViewController alloc] init];
  45. achievementsvc.title = @"需求";
  46. Demandvc = [[DemandViewController alloc] init];
  47. Demandvc.title = @"专家";
  48. expertvc = [[ExpertViewController alloc] init];
  49. expertvc.title = @"项目";
  50. policyvc = [[PolicyViewController alloc] init];
  51. policyvc.title = @"咨询师";
  52. [slider setViewControllers:@[wholevc,achievementsvc,Demandvc,expertvc,policyvc] owner:self page:_page];
  53. [self.view addSubview:slider];
  54. UIView *controlView = [slider topControlViewWithFrame:CGRectMake(0, ViewStartY, SCREEN_WIDTH, 44) titleLabelWidth:SCREEN_WIDTH/5 page:0];
  55. [self.view addSubview:controlView];
  56. }
  57. - (void)autoDownRefresh:(NSInteger)index
  58. {
  59. if (index == 0) {
  60. [wholevc networkRequest:nil];
  61. }else if (index == 1) {
  62. [achievementsvc networkRequest:nil];
  63. }else if (index == 2) {
  64. [Demandvc networkRequest:nil];
  65. }else if (index == 3) {
  66. [expertvc networkRequest:nil];
  67. }else if (index == 4) {
  68. [policyvc networkRequest:nil];
  69. }
  70. }
  71. - (void)didReceiveMemoryWarning {
  72. [super didReceiveMemoryWarning];
  73. // Dispose of any resources that can be recreated.
  74. }
  75. /*
  76. #pragma mark - Navigation
  77. // In a storyboard-based application, you will often want to do a little preparation before navigation
  78. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  79. // Get the new view controller using [segue destinationViewController].
  80. // Pass the selected object to the new view controller.
  81. }
  82. */
  83. @end