YOUPAILCBoardVC.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. //
  2. // YOUPAILCBoardVC.m
  3. // LiveChat
  4. //
  5. // Created by 张灿 on 2018/9/26.
  6. // Copyright © 2018年 caicai. All rights reserved.
  7. //
  8. #import "YOUPAILCBoardVC.h"
  9. #import "YOUPAILCBoardDetailVC.h"
  10. #import "ZCNavMenuView.h"
  11. @interface YOUPAILCBoardVC ()<ZCNavMenuViewDelegate,UIScrollViewDelegate>
  12. @property(nonatomic,strong)ZCNavMenuView* youpaipnavView;
  13. @property(nonatomic,strong)UIScrollView* youpaipscrollView;
  14. @property(nonatomic,strong)YOUPAILCBoardDetailVC* youpaipwealthBoardVC;
  15. @property(nonatomic,strong)YOUPAILCBoardDetailVC* youpaipbigCastBoardVC;
  16. @property(nonatomic,strong)YOUPAILCBoardDetailVC* youpaipgiftBoardVC;
  17. @property(nonatomic,strong)YOUPAILCBoardDetailVC* youpaipfeeBoardVC;
  18. @property(nonatomic,strong)YOUPAILCBoardDetailVC *youpaipguardBoardVC;
  19. @property(nonatomic,strong)YOUPAILCBoardDetailVC *youpaipxianNvBangBoardVC;
  20. @property(nonatomic,strong)YOUPAILCBoardDetailVC *youpaipboLeBangBoardVC;
  21. @property(nonatomic,strong)UILabel *youpaiptitleLab;
  22. @property(nonatomic,strong)NSMutableArray *youpaiptitleArray;
  23. @end
  24. @implementation YOUPAILCBoardVC
  25. - (UIScrollView *)youpaipscrollView{
  26. if (!_youpaipscrollView) {
  27. _youpaipscrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, NavBarHeight, KScreenWidth, KScreenHeight-NavBarHeight)];
  28. _youpaipscrollView.scrollEnabled = YES;
  29. _youpaipscrollView.pagingEnabled = YES;
  30. _youpaipscrollView.bounces = NO;
  31. _youpaipscrollView.delegate = self;
  32. _youpaipscrollView.showsVerticalScrollIndicator = NO;
  33. _youpaipscrollView.showsHorizontalScrollIndicator = NO;
  34. _youpaipscrollView.contentSize = CGSizeMake(5*CGRectGetWidth(_youpaipscrollView.frame), CGRectGetHeight(_youpaipscrollView.frame));
  35. }
  36. return _youpaipscrollView;
  37. }
  38. - (UIStatusBarStyle)preferredStatusBarStyle {
  39. return UIStatusBarStyleLightContent;
  40. }
  41. - (void)viewWillAppear:(BOOL)animated{
  42. [super viewWillAppear:animated];
  43. //导航栏渐变色
  44. [self.navigationController.navigationBar setBackgroundImage:[LCTools ColorImage:CGSizeMake(KScreenWidth, NavBarHeight) FromColors:@[HexColorFromRGB(0xFFCECE),HexColorFromRGB(0xE3BDD8)] ByGradientType:GradientTopToBottom] forBarMetrics:UIBarMetricsDefault];
  45. [LCHttpHelper requestWithURLString:GetRankTab parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  46. NSDictionary* dict = (NSDictionary*)responseObject;
  47. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  48. if (code==0) {//成功
  49. NSInteger is_switch = [[NSString stringWithFormat:@"%@",[[dict objectForKey:@"data"] objectForKey:@"is_switch"]] integerValue];//仙女榜 1开启 2关闭
  50. NSInteger is_bole = [[NSString stringWithFormat:@"%@",[[dict objectForKey:@"data"] objectForKey:@"is_bole"]] integerValue];//伯乐榜 1开启 2关闭
  51. BOOL needRefresh = NO;
  52. if (is_switch == 1) {
  53. if (![LCSaveData getIsXianNvBang]) {
  54. [self->_youpaiptitleArray insertObject:@"仙女榜" atIndex:0];
  55. [LCSaveData saveIsXianNvBang:YES];
  56. needRefresh = YES;
  57. }
  58. }else{
  59. if ([LCSaveData getIsXianNvBang]) {
  60. [LCSaveData saveIsXianNvBang:NO];
  61. if ([self->_youpaiptitleArray containsObject:@"仙女榜"]) {
  62. [self->_youpaiptitleArray removeObject:@"仙女榜"];
  63. }
  64. needRefresh = YES;
  65. }
  66. }
  67. if (is_bole == 1) {
  68. if (![LCSaveData getIsBoLeBang]) {
  69. [self->_youpaiptitleArray addObject:@"伯乐榜"];
  70. [LCSaveData saveIsBoLeBang:YES];
  71. needRefresh = YES;
  72. }
  73. }else{
  74. if ([LCSaveData getIsBoLeBang]) {
  75. [LCSaveData saveIsBoLeBang:NO];
  76. if ([self->_youpaiptitleArray containsObject:@"伯乐榜"]) {
  77. [self->_youpaiptitleArray removeObject:@"伯乐榜"];
  78. }
  79. needRefresh = YES;
  80. }
  81. }
  82. NSLog(@"%@",self->_youpaiptitleArray);
  83. if (needRefresh) {
  84. [self.youpaipscrollView removeFromSuperview];
  85. [self youpaifsetXianNvBangAndBoLeBangUI];
  86. }
  87. }
  88. } failure:^(NSError *error) {
  89. }];
  90. }
  91. - (void)viewWillDisappear:(BOOL)animated{
  92. [super viewWillDisappear:animated];
  93. [self.navigationController.navigationBar setDefaultBar];
  94. self.navigationController.navigationBar.barTintColor = LCWhiteColor;
  95. // [_youpaiptitleLab setHidden:YES];
  96. }
  97. - (void)viewDidLoad {
  98. [super viewDidLoad];
  99. self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifbackClick) image:[UIImage imageNamed:@"vqu_images_navigation_back_black"]];
  100. // self.sx_disableInteractivePop = YES;
  101. [self.view addSubview:self.youpaipscrollView];
  102. // @[@"魅力榜",@"礼物榜",@"守护榜",@"消费榜",@"新人榜"]
  103. self.youpaiptitleArray = [NSMutableArray arrayWithArray:@[@"魅力榜",@"女神榜",@"新人榜"]];
  104. if ([LCSaveData getIsXianNvBang]) {
  105. [self->_youpaiptitleArray insertObject:@"仙女榜" atIndex:0];
  106. }
  107. if ([LCSaveData getIsBoLeBang]) {
  108. [self->_youpaiptitleArray addObject:@"伯乐榜"];
  109. }
  110. [self youpaifsetXianNvBangAndBoLeBangUI];
  111. }
  112. -(void)youpaifsetXianNvBangAndBoLeBangUI{
  113. self->_youpaipscrollView.contentSize = CGSizeMake(self.youpaiptitleArray.count*CGRectGetWidth(self->_youpaipscrollView.frame), CGRectGetHeight(self->_youpaipscrollView.frame));
  114. UIScrollView *navScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth - 60.0f, 28.0f)];
  115. navScrollView.showsVerticalScrollIndicator = NO;
  116. navScrollView.showsHorizontalScrollIndicator = NO;
  117. navScrollView.contentSize = CGSizeMake(self.youpaiptitleArray.count * 68.0f, 28);
  118. ZCNavMenuView* navMenu = [[ZCNavMenuView alloc]initWithFrame:CGRectMake(0, 0,self.youpaiptitleArray.count * 68.0f, 28) TitleArr:self.youpaiptitleArray normalFont:LCBoldFont(14) normalColor:HexColorFromRGB(0xffffff) selectFont:LCBoldFont(16) selectColor:HexColorFromRGB(0xffffff) selectLineColor:HexColorFromRGB(0xA7A9FD) currentIndex:0 isBackground:YES];
  119. navMenu.delegate = self;
  120. self.youpaipnavView = navMenu;
  121. [navScrollView addSubview:navMenu];
  122. self.navigationItem.titleView = navScrollView;
  123. [self.view addSubview:self.youpaipscrollView];
  124. int i = 0;
  125. if ([LCSaveData getIsXianNvBang]) {
  126. self.youpaipxianNvBangBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  127. self.youpaipxianNvBangBoardVC.youpaiptype = 5;
  128. self.youpaipxianNvBangBoardVC.view.frame = CGRectMake(0, 0, KScreenWidth, CGRectGetHeight(self->_youpaipscrollView.frame));
  129. [self.youpaipscrollView addSubview:self.youpaipxianNvBangBoardVC.view];
  130. [self addChildViewController:self.youpaipxianNvBangBoardVC];
  131. i = 1;
  132. }
  133. self.youpaipbigCastBoardVC = [[YOUPAILCBoardDetailVC alloc] init];
  134. self.youpaipbigCastBoardVC.youpaiptype = 0;
  135. self.youpaipbigCastBoardVC.view.frame = CGRectMake(KScreenWidth*i, 0, KScreenWidth, CGRectGetHeight(self->_youpaipscrollView.frame));
  136. [self.youpaipscrollView addSubview:self.youpaipbigCastBoardVC.view];
  137. [self addChildViewController:self.youpaipbigCastBoardVC];
  138. self.youpaipgiftBoardVC = [[YOUPAILCBoardDetailVC alloc] init];
  139. self.youpaipgiftBoardVC.youpaiptype = 7;
  140. self.youpaipgiftBoardVC.view.frame = CGRectMake(KScreenWidth*(i+1), 0, KScreenWidth, CGRectGetHeight(self->_youpaipscrollView.frame));
  141. [self.youpaipscrollView addSubview:self.youpaipgiftBoardVC.view];
  142. [self addChildViewController:self.youpaipgiftBoardVC];
  143. self.youpaipguardBoardVC = [[YOUPAILCBoardDetailVC alloc] init];
  144. self.youpaipguardBoardVC.youpaiptype = 4;
  145. self.youpaipguardBoardVC.view.frame = CGRectMake(KScreenWidth*(i+2), 0, KScreenWidth, CGRectGetHeight(self->_youpaipscrollView.frame));
  146. [self.youpaipscrollView addSubview:self.youpaipguardBoardVC.view];
  147. [self addChildViewController:self.youpaipguardBoardVC];
  148. self.youpaipfeeBoardVC = [[YOUPAILCBoardDetailVC alloc] init];
  149. self.youpaipfeeBoardVC.youpaiptype = 3;
  150. self.youpaipfeeBoardVC.view.frame = CGRectMake(KScreenWidth*(i+3), 0, KScreenWidth, CGRectGetHeight(self->_youpaipscrollView.frame));
  151. [self.youpaipscrollView addSubview:self.youpaipfeeBoardVC.view];
  152. [self addChildViewController:self.youpaipfeeBoardVC];
  153. self.youpaipwealthBoardVC = [[YOUPAILCBoardDetailVC alloc] init];
  154. self.youpaipwealthBoardVC.youpaiptype = 4;
  155. self.youpaipwealthBoardVC.view.frame = CGRectMake(KScreenWidth*(i+4), 0, KScreenWidth, CGRectGetHeight(self->_youpaipscrollView.frame));
  156. [self.youpaipscrollView addSubview:self.youpaipwealthBoardVC.view];
  157. [self addChildViewController:self.youpaipwealthBoardVC];
  158. [self youpaifnavBtnClick:self->_youpaipindex];
  159. if ([LCSaveData getIsBoLeBang]) {
  160. self.youpaipboLeBangBoardVC = [[YOUPAILCBoardDetailVC alloc] init];
  161. self.youpaipboLeBangBoardVC.youpaiptype = 6;
  162. self.youpaipboLeBangBoardVC.view.frame = CGRectMake(KScreenWidth*(i+5), 0, KScreenWidth, CGRectGetHeight(self->_youpaipscrollView.frame));
  163. [self.youpaipscrollView addSubview:self.youpaipboLeBangBoardVC.view];
  164. [self addChildViewController:self.youpaipboLeBangBoardVC];
  165. }
  166. }
  167. //// 仙女榜有 伯乐榜无
  168. //-(void)setHaveXianNvBangAndNOBoLeBangUI
  169. //{
  170. // self->_scrollView.contentSize = CGSizeMake(6*CGRectGetWidth(self->_scrollView.frame), CGRectGetHeight(self->_scrollView.frame));
  171. // ZCNavMenuView* navMenu = [[ZCNavMenuView alloc]initWithFrame:CGRectMake(0, 0, 310, 28) TitleArr:@[@"仙女榜",@"魅力榜",@"礼物榜",@"守护榜",@"消费榜",@"钻石榜"] normalFont:LCBoldFont(14) normalColor:HexColorFromRGB(0xffffff) selectFont:LCBoldFont(16) selectColor:ZYPinkColor selectLineColor:HexColorFromRGBA(0xffffff,1.0) currentIndex:0 isBackground:YES];
  172. // navMenu.delegate = self;
  173. // self.navView = navMenu;
  174. // self.navigationItem.titleView = navMenu;
  175. // [self.view addSubview:self.scrollView];
  176. // self.youpaipxianNvBangBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  177. // self.youpaipxianNvBangBoardVC.type = 5;
  178. // self.youpaipxianNvBangBoardVC.view.frame = CGRectMake(0, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  179. // [self.scrollView addSubview:self.youpaipxianNvBangBoardVC.view];
  180. // [self addChildViewController:self.youpaipxianNvBangBoardVC];
  181. //
  182. // self.youpaipbigCastBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  183. // self.youpaipbigCastBoardVC.type = 0;
  184. // self.youpaipbigCastBoardVC.view.frame = CGRectMake(KScreenWidth*1, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  185. // [self.scrollView addSubview:self.youpaipbigCastBoardVC.view];
  186. // [self addChildViewController:self.youpaipbigCastBoardVC];
  187. //
  188. // self.youpaipgiftBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  189. // self.youpaipgiftBoardVC.type = 1;
  190. // self.youpaipgiftBoardVC.view.frame = CGRectMake(KScreenWidth*2, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  191. // [self.scrollView addSubview:self.youpaipgiftBoardVC.view];
  192. // [self addChildViewController:self.youpaipgiftBoardVC];
  193. //
  194. // self.youpaipguardBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  195. // self.youpaipguardBoardVC.type = 2;
  196. // self.youpaipguardBoardVC.view.frame = CGRectMake(KScreenWidth*3, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  197. // [self.scrollView addSubview:self.youpaipguardBoardVC.view];
  198. // [self addChildViewController:self.youpaipguardBoardVC];
  199. //
  200. // self.youpaipfeeBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  201. // self.youpaipfeeBoardVC.type = 3;
  202. // self.youpaipfeeBoardVC.view.frame = CGRectMake(KScreenWidth*4, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  203. // [self.scrollView addSubview:self.youpaipfeeBoardVC.view];
  204. // [self addChildViewController:self.youpaipfeeBoardVC];
  205. //
  206. // self.wealthBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  207. // self.wealthBoardVC.type = 4;
  208. // self.wealthBoardVC.view.frame = CGRectMake(KScreenWidth*5, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  209. // [self.scrollView addSubview:self.wealthBoardVC.view];
  210. // [self addChildViewController:self.wealthBoardVC];
  211. // [self youpaifnavBtnClick:self->_index];
  212. //
  213. //}
  214. //// 仙女榜无 伯乐榜有
  215. //-(void)setNoXianNvBangAndHaveBoLeBangUI{
  216. //
  217. //}
  218. //// 仙女榜无 伯乐榜无
  219. //-(void)setNOXianNvBangAndNOBoLeBangUI
  220. //{
  221. //
  222. //}
  223. //// 没有仙女榜
  224. //- (void)setNoXianNvBangUI
  225. //{
  226. // self->_scrollView.contentSize = CGSizeMake(5*CGRectGetWidth(self->_scrollView.frame), CGRectGetHeight(self->_scrollView.frame));
  227. // ZCNavMenuView* navMenu = [[ZCNavMenuView alloc]initWithFrame:CGRectMake(0, 0, 310, 28) TitleArr:@[@"魅力榜",@"礼物榜",@"守护榜",@"消费榜",@"钻石榜"] normalFont:LCBoldFont(14) normalColor:HexColorFromRGB(0xffffff) selectFont:LCBoldFont(16) selectColor:ZYPinkColor selectLineColor:HexColorFromRGBA(0xffffff,1.0) currentIndex:0 isBackground:YES];
  228. // navMenu.delegate = self;
  229. // self.navView = navMenu;
  230. // self.navigationItem.titleView = navMenu;
  231. // [self.view addSubview:self.scrollView];
  232. //
  233. //
  234. // self.youpaipbigCastBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  235. // self.youpaipbigCastBoardVC.type = 0;
  236. // self.youpaipbigCastBoardVC.view.frame = CGRectMake(0, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  237. // [self.scrollView addSubview:self.youpaipbigCastBoardVC.view];
  238. // [self addChildViewController:self.youpaipbigCastBoardVC];
  239. // self.youpaipgiftBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  240. // self.youpaipgiftBoardVC.type = 1;
  241. // self.youpaipgiftBoardVC.view.frame = CGRectMake(KScreenWidth, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  242. // [self.scrollView addSubview:self.youpaipgiftBoardVC.view];
  243. // [self addChildViewController:self.youpaipgiftBoardVC];
  244. // self.youpaipguardBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  245. // self.youpaipguardBoardVC.type = 2;
  246. // self.youpaipguardBoardVC.view.frame = CGRectMake(KScreenWidth*2, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  247. // [self.scrollView addSubview:self.youpaipguardBoardVC.view];
  248. // [self addChildViewController:self.youpaipguardBoardVC];
  249. //
  250. // self.youpaipfeeBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  251. // self.youpaipfeeBoardVC.type = 3;
  252. // self.youpaipfeeBoardVC.view.frame = CGRectMake(KScreenWidth*3, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  253. // [self.scrollView addSubview:self.youpaipfeeBoardVC.view];
  254. // [self addChildViewController:self.youpaipfeeBoardVC];
  255. //
  256. // self.wealthBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  257. // self.wealthBoardVC.type = 4;
  258. // self.wealthBoardVC.view.frame = CGRectMake(KScreenWidth*4, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  259. // [self.scrollView addSubview:self.wealthBoardVC.view];
  260. // [self addChildViewController:self.wealthBoardVC];
  261. // [self youpaifnavBtnClick:self->_index];
  262. //
  263. //}
  264. ////有仙女榜
  265. //- (void)setHaveXianNvBangUI
  266. //{
  267. // self->_scrollView.contentSize = CGSizeMake(6*CGRectGetWidth(self->_scrollView.frame), CGRectGetHeight(self->_scrollView.frame));
  268. // ZCNavMenuView* navMenu = [[ZCNavMenuView alloc]initWithFrame:CGRectMake(0, 0, 310, 28) TitleArr:@[@"仙女榜",@"魅力榜",@"礼物榜",@"守护榜",@"消费榜",@"钻石榜"] normalFont:LCBoldFont(14) normalColor:HexColorFromRGB(0xffffff) selectFont:LCBoldFont(16) selectColor:ZYPinkColor selectLineColor:HexColorFromRGBA(0xffffff,1.0) currentIndex:0 isBackground:YES];
  269. // navMenu.delegate = self;
  270. // self.navView = navMenu;
  271. // self.navigationItem.titleView = navMenu;
  272. // [self.view addSubview:self.scrollView];
  273. // self.youpaipxianNvBangBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  274. // self.youpaipxianNvBangBoardVC.type = 5;
  275. // self.youpaipxianNvBangBoardVC.view.frame = CGRectMake(0, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  276. // [self.scrollView addSubview:self.youpaipxianNvBangBoardVC.view];
  277. // [self addChildViewController:self.youpaipxianNvBangBoardVC];
  278. //
  279. // self.youpaipbigCastBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  280. // self.youpaipbigCastBoardVC.type = 0;
  281. // self.youpaipbigCastBoardVC.view.frame = CGRectMake(KScreenWidth*1, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  282. // [self.scrollView addSubview:self.youpaipbigCastBoardVC.view];
  283. // [self addChildViewController:self.youpaipbigCastBoardVC];
  284. //
  285. // self.youpaipgiftBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  286. // self.youpaipgiftBoardVC.type = 1;
  287. // self.youpaipgiftBoardVC.view.frame = CGRectMake(KScreenWidth*2, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  288. // [self.scrollView addSubview:self.youpaipgiftBoardVC.view];
  289. // [self addChildViewController:self.youpaipgiftBoardVC];
  290. //
  291. // self.youpaipguardBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  292. // self.youpaipguardBoardVC.type = 2;
  293. // self.youpaipguardBoardVC.view.frame = CGRectMake(KScreenWidth*3, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  294. // [self.scrollView addSubview:self.youpaipguardBoardVC.view];
  295. // [self addChildViewController:self.youpaipguardBoardVC];
  296. //
  297. // self.youpaipfeeBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  298. // self.youpaipfeeBoardVC.type = 3;
  299. // self.youpaipfeeBoardVC.view.frame = CGRectMake(KScreenWidth*4, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  300. // [self.scrollView addSubview:self.youpaipfeeBoardVC.view];
  301. // [self addChildViewController:self.youpaipfeeBoardVC];
  302. //
  303. // self.wealthBoardVC = [[YOUPAILCBoardDetailVC alloc]init];
  304. // self.wealthBoardVC.type = 4;
  305. // self.wealthBoardVC.view.frame = CGRectMake(KScreenWidth*5, 0, KScreenWidth, CGRectGetHeight(self->_scrollView.frame));
  306. // [self.scrollView addSubview:self.wealthBoardVC.view];
  307. // [self addChildViewController:self.wealthBoardVC];
  308. // [self youpaifnavBtnClick:self->_index];
  309. //
  310. //
  311. //}
  312. - (void)youpaifbackClick{
  313. [self.navigationController popViewControllerAnimated:YES];
  314. }
  315. -(UILabel *)youpaiptitleLab
  316. {
  317. if(!_youpaiptitleLab)
  318. {
  319. _youpaiptitleLab = [[UILabel alloc]initWithFrame:CGRectMake(80, 0, KScreenWidth-160, 44)];
  320. [_youpaiptitleLab setBackgroundColor:[UIColor clearColor]];
  321. [_youpaiptitleLab setTextColor:[UIColor whiteColor]];
  322. _youpaiptitleLab.font = [UIFont systemFontOfSize:18];
  323. _youpaiptitleLab.textAlignment = NSTextAlignmentCenter;
  324. }
  325. return _youpaiptitleLab;
  326. }
  327. -(void)setYoupaipindex:(NSInteger)youpaipindex
  328. {
  329. _youpaipindex = youpaipindex;
  330. [self youpaifnavBtnClick:youpaipindex];
  331. [self.youpaipnavView changeCurrentSelectButton:youpaipindex];
  332. }
  333. - (void)youpaifnavBtnClick:(NSInteger)index{
  334. self.youpaipscrollView.contentOffset = CGPointMake(KScreenWidth*index, 0);
  335. }
  336. - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
  337. [self.view endEditing:YES];
  338. if ([scrollView isEqual:self.youpaipscrollView]) {
  339. CGFloat offsetX = scrollView.contentOffset.x;
  340. // if ([LCSaveData getIsXianNvBang]) {
  341. // self.navView.selectView.frame = CGRectMake((self.navView.frame.size.width/self.titleArray.count)*(offsetX/KScreenWidth), self.navView.selectView.frame.origin.y, self.navView.selectView.frame.size.width, self.navView.selectView.frame.size.height);
  342. // }else{
  343. // self.navView.selectView.frame = CGRectMake((self.navView.frame.size.width/5)*(offsetX/KScreenWidth), self.navView.selectView.frame.origin.y, self.navView.selectView.frame.size.width, self.navView.selectView.frame.size.height);
  344. // }
  345. self.youpaipnavView.selectView.frame = CGRectMake((self.youpaipnavView.frame.size.width/self.youpaiptitleArray.count)*(offsetX/KScreenWidth), self.youpaipnavView.selectView.frame.origin.y, self.youpaipnavView.selectView.frame.size.width, self.youpaipnavView.selectView.frame.size.height);
  346. // _selectView.frame = CGRectMake((_selectIndex-1000)*self.frame.size.width/_titleArr.count,0,self.frame.size.width/_titleArr.count, self.frame.size.height);
  347. }
  348. }
  349. - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
  350. if ([scrollView isEqual:self.youpaipscrollView]) {
  351. CGPoint offset = scrollView.contentOffset;
  352. NSInteger index = offset.x/KScreenWidth;
  353. [self.youpaipnavView changeCurrentSelectButton:index];
  354. }
  355. }
  356. -(void)dealloc
  357. {
  358. NSLog(@"lcboardvc dealloc");
  359. }
  360. @end