TenantDarkViewController.m 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. //
  2. // TenantDarkViewController.m
  3. // KulexiuForStudent
  4. //
  5. // Created by 王智 on 2023/9/12.
  6. //
  7. #import "TenantDarkViewController.h"
  8. #import "InstitutionNomalNavView.h"
  9. #import "TenantDarkSearhView.h"
  10. #import "KSBaseWKWebViewController.h"
  11. #import "TenantDragView.h"
  12. #import "ToneTuningViewController.h"
  13. #import "TenantDarkEmptyView.h"
  14. #import "TYCyclePagerView.h"
  15. #import "TenantHomeSubjectListCell.h"
  16. #import "UserInfoManager.h"
  17. #import "TenantTicketAlert.h"
  18. #import "AppDelegate+AppService.h"
  19. #import "TenantAlbumModel.h"
  20. #import "AlbumSwitchView.h"
  21. @interface TenantDarkViewController ()<TYCyclePagerViewDelegate, TYCyclePagerViewDataSource>
  22. @property (nonatomic, copy) SwitchMoreCallback callback;
  23. @property (nonatomic, strong) InstitutionNomalNavView *navView;
  24. @property (nonatomic, strong) TenantDarkSearhView *searchView;
  25. @property (nonatomic, strong) TenantDragView *suspendButton;
  26. @property (nonatomic, strong) TenantDarkEmptyView *emptyAniView;
  27. @property (nonatomic, strong) TYCyclePagerView *pagerView;
  28. @property (nonatomic, strong) NSMutableArray *animationNameArray;
  29. @property (nonatomic, strong) UserInfo *mineInfo;
  30. @property (nonatomic, strong) dispatch_group_t requestGroup;
  31. @property (nonatomic, strong) TenantTicketAlert *alert;
  32. @property (nonatomic, assign) BOOL hasShowTipsView;
  33. @property (nonatomic, assign) BOOL isFirstLoad;
  34. @property (nonatomic, strong) NSMutableArray *sourceArray; // 分类数据
  35. @property (nonatomic, assign) NSInteger albumCount; // 专辑数量
  36. @property (nonatomic, strong) NSString *chooseAlbumId; // 选择的专辑编号
  37. @property (nonatomic, strong) NSMutableArray *albumListArray; // 专辑数据
  38. @property (nonatomic, strong) GroupAlbumModel *albumModel; // 小组专辑信息
  39. @end
  40. @implementation TenantDarkViewController
  41. - (void)swithToMorePageAction:(SwitchMoreCallback)callback {
  42. if (callback) {
  43. self.callback = callback;
  44. }
  45. }
  46. - (void)viewDidLoad {
  47. [super viewDidLoad];
  48. // Do any additional setup after loading the view.
  49. [self configUI];
  50. self.isFirstLoad = YES;
  51. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didBecomeActive) name:@"appDidBecomeActive" object:nil];
  52. self.chooseAlbumId = UserDefault(TENANT_ALBUMID);
  53. }
  54. - (void)didBecomeActive {
  55. if (self.sourceArray.count == 0) {
  56. [self.emptyAniView startPlay];
  57. }
  58. else {
  59. TenantHomeSubjectListCell *cell = (TenantHomeSubjectListCell *)[self.pagerView curIndexCell];
  60. [cell startAnimation];
  61. }
  62. }
  63. - (void)viewWillAppear:(BOOL)animated {
  64. [super viewWillAppear:animated];
  65. [self requestSource];
  66. if (self.isFirstLoad == YES) {
  67. self.isFirstLoad = NO;
  68. [self requestTrackAuth];
  69. }
  70. else {
  71. NSLog(@"view app");
  72. [self didBecomeActive];
  73. }
  74. }
  75. - (void)requestTrackAuth {
  76. AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
  77. [appDelegate appTrackActionAuth];
  78. [appDelegate handleNotiferSource];
  79. }
  80. - (void)requestSource {
  81. [self requestUserInfo];
  82. [self requestData];
  83. [self requsetTicket];
  84. dispatch_group_notify(self.requestGroup, dispatch_get_main_queue(), ^{
  85. [self refreshView];
  86. });
  87. }
  88. - (void)requestUserInfo {
  89. dispatch_group_enter(self.requestGroup);
  90. [USER_MANAGER queryUserInfoCallback:^(UserInfo * _Nonnull userInfo) {
  91. dispatch_group_leave(self.requestGroup);
  92. self.mineInfo = userInfo;
  93. }];
  94. }
  95. - (void)ticketCheck:(NSInteger)count {
  96. if (self.hasShowTipsView == YES) {
  97. return;
  98. }
  99. AppDelegate *appDelegate = [AppDelegate shareAppDelegate];
  100. if (appDelegate.isShowMemoAlert) {
  101. return;
  102. }
  103. if (count > 0) {
  104. appDelegate.isShowFlashAlert = YES;
  105. self.alert = [TenantTicketAlert shareInstance];
  106. MJWeakSelf;
  107. [self.alert configCount:count callback:^(BOOL isActivate) {
  108. if (isActivate) {
  109. appDelegate.isShowFlashAlert = NO;
  110. [weakSelf showActivateView];
  111. }
  112. [appDelegate showMemoAlert]; // 检测是否需要弹窗版本更新
  113. }];
  114. [self.alert showAlert];
  115. self.hasShowTipsView = YES;
  116. }
  117. }
  118. - (void)showActivateView {
  119. KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
  120. webCtrl.url = [NSString stringWithFormat:@"%@/#/activation-code", TENANT_WEBHOST];
  121. [self.navigationController pushViewController:webCtrl animated:YES];
  122. }
  123. - (void)requsetTicket {
  124. dispatch_group_enter(self.requestGroup);
  125. [KSNetworkingManager tenantActivationCodeRequest:KS_POST success:^(NSDictionary * _Nonnull dic) {
  126. dispatch_group_leave(self.requestGroup);
  127. if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
  128. NSInteger count = [[dic ks_dictionaryValueForKey:@"data"] ks_integerValueForKey:@"total"];
  129. [self ticketCheck:count];
  130. }
  131. else {
  132. }
  133. } faliure:^(NSError * _Nonnull error) {
  134. dispatch_group_leave(self.requestGroup);
  135. }];
  136. }
  137. - (void)requestData {
  138. dispatch_group_enter(self.requestGroup);
  139. [KSNetworkingManager userTenantAlbumListRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
  140. dispatch_group_leave(self.requestGroup);
  141. if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
  142. NSArray *albumList = [dic ks_arrayValueForKey:@"data"];
  143. NSMutableArray *list = [NSMutableArray array];
  144. for (NSDictionary *parm in albumList) {
  145. GroupAlbumModel *model = [[GroupAlbumModel alloc] initWithDictionary:parm];
  146. [list addObject:model];
  147. }
  148. self.albumListArray = [NSMutableArray arrayWithArray:list];
  149. }
  150. else {
  151. [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
  152. }
  153. } faliure:^(NSError * _Nonnull error) {
  154. dispatch_group_leave(self.requestGroup);
  155. }];
  156. }
  157. - (void)showEmptyView {
  158. self.emptyAniView.hidden = NO;
  159. [self.emptyAniView startPlay];
  160. }
  161. - (void)hideEmptyView {
  162. self.emptyAniView.hidden = YES;
  163. [self.emptyAniView stopPlay];
  164. }
  165. - (void)refreshView {
  166. self.navView.tenantName.text = [NSString returnNoNullStringWithString:self.mineInfo.tenantName];
  167. self.albumCount = self.albumListArray.count;
  168. // 有专辑数据
  169. if (self.albumListArray.count > 0) {
  170. // 如果没有选择专辑 取第一个
  171. GroupAlbumModel *displayModel = nil;
  172. if ([NSString isEmptyString:self.chooseAlbumId]) {
  173. GroupAlbumModel *model = self.albumListArray[0];
  174. displayModel = model;
  175. }
  176. else {
  177. // 数据处理
  178. for (GroupAlbumModel *model in self.albumListArray) {
  179. if ([self.chooseAlbumId isEqualToString:model.internalBaseClassIdentifier]) {
  180. displayModel = model;
  181. }
  182. }
  183. if (displayModel == nil) {
  184. GroupAlbumModel *model = self.albumListArray[0];
  185. displayModel = model;
  186. }
  187. }
  188. [self refreshWithModel:displayModel];
  189. }
  190. else { // 空
  191. self.sourceArray = [NSMutableArray array];
  192. self.animationNameArray = [NSMutableArray array];
  193. [self showEmptyView];
  194. [self.pagerView reloadData];
  195. }
  196. }
  197. - (void)refreshWithModel:(GroupAlbumModel *)displayModel {
  198. self.albumModel = displayModel;
  199. self.chooseAlbumId = displayModel.internalBaseClassIdentifier;
  200. UserDefaultSet(self.chooseAlbumId, TENANT_ALBUMID);
  201. [self.navView configAlbumName:displayModel.name];
  202. NSMutableArray *sourceArray = [NSMutableArray array];
  203. NSMutableArray *aniArray = [NSMutableArray array];
  204. // COURSEWARE
  205. if (displayModel.coursewareCounts > 0) {
  206. TenantAlbumModel *model = [[TenantAlbumModel alloc] init];
  207. model.subjectType = @"COURSEWARE";
  208. [sourceArray addObject:model];
  209. [aniArray addObject:@"cloudCourse_Ani.json"];
  210. }
  211. // 声部
  212. if (displayModel.subjectCounts > 0) {
  213. TenantAlbumModel *model = [[TenantAlbumModel alloc] init];
  214. model.subjectType = @"SUBJECT";
  215. [sourceArray addObject:model];
  216. [aniArray addObject:@"subject_Ani.json"];
  217. }
  218. // 独奏
  219. if (displayModel.musicCounts > 0) {
  220. TenantAlbumModel *model = [[TenantAlbumModel alloc] init];
  221. model.subjectType = @"MUSIC";
  222. [sourceArray addObject:model];
  223. [aniArray addObject:@"singleMusic_Ani.json"];
  224. }
  225. // 合奏
  226. if (displayModel.ensembleCounts > 0) {
  227. TenantAlbumModel *model = [[TenantAlbumModel alloc] init];
  228. model.subjectType = @"ENSEMBLE";
  229. [sourceArray addObject:model];
  230. [aniArray addObject:@"mutiMusic_Ani.json"];
  231. }
  232. self.sourceArray = [NSMutableArray arrayWithArray:sourceArray];
  233. self.animationNameArray = [NSMutableArray arrayWithArray:aniArray];
  234. [self.pagerView reloadData];
  235. if (self.sourceArray.count > 0) {
  236. [self hideEmptyView];
  237. }
  238. else {
  239. [self showEmptyView];
  240. }
  241. }
  242. - (void)configUI {
  243. [self.scrollView removeFromSuperview];
  244. UIImageView *bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tenant_bg_dark"]];
  245. bgImageView.contentMode = UIViewContentModeRedraw;
  246. [self.view addSubview:bgImageView];
  247. [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  248. make.left.right.top.bottom.mas_equalTo(self.view);
  249. }];
  250. [self.view addSubview:self.navView];
  251. CGFloat navHeight = [InstitutionNomalNavView getViewHeight];
  252. [self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
  253. make.left.right.top.mas_equalTo(self.view);
  254. make.height.mas_equalTo(navHeight);
  255. }];
  256. [self.view addSubview:self.searchView];
  257. CGFloat searchHeight = [TenantDarkSearhView getViewHeight];
  258. [self.searchView mas_makeConstraints:^(MASConstraintMaker *make) {
  259. make.left.right.mas_equalTo(self.view);
  260. make.top.mas_equalTo(self.navView.mas_bottom);
  261. make.height.mas_equalTo(searchHeight);
  262. }];
  263. // collec
  264. [self.view addSubview:self.pagerView];
  265. [self.pagerView mas_makeConstraints:^(MASConstraintMaker *make) {
  266. make.top.mas_equalTo(self.searchView.mas_bottom);
  267. make.left.right.mas_equalTo(self.view);
  268. make.bottom.mas_equalTo(self.view.mas_bottom).offset(-16);
  269. }];
  270. [self.view addSubview:self.emptyAniView];
  271. [self.emptyAniView mas_makeConstraints:^(MASConstraintMaker *make) {
  272. make.top.mas_equalTo(self.searchView.mas_bottom);
  273. make.left.right.mas_equalTo(self.view);
  274. make.bottom.mas_equalTo(self.view.mas_bottom).offset(-16);
  275. }];
  276. self.emptyAniView.hidden = YES;
  277. [self showFloatingWindow];
  278. }
  279. - (void)showFloatingWindow {
  280. if (![self.view.subviews containsObject:self.suspendButton]) {
  281. [self.view addSubview:self.suspendButton];
  282. }
  283. [self.view bringSubviewToFront:self.suspendButton];
  284. }
  285. #pragma mark ------ TYCyclePagerViewDataSource
  286. - (NSInteger)numberOfItemsInPagerView:(TYCyclePagerView *)pageView {
  287. return self.sourceArray.count;
  288. }
  289. - (__kindof UICollectionViewCell *)pagerView:(TYCyclePagerView *)pagerView cellForItemAtIndex:(NSInteger)index {
  290. BOOL isLock = self.albumModel.status == YES ? NO : YES;
  291. TenantHomeSubjectListCell *cell = [pagerView dequeueReusableCellWithReuseIdentifier:@"TenantHomeSubjectListCell" forIndex:index];
  292. [cell configWithJsonSting:self.animationNameArray[index] isLock:isLock];
  293. if (pagerView.curIndex == index) {
  294. [cell startAnimation];
  295. }
  296. else {
  297. [cell stopAnimation];
  298. }
  299. return cell;
  300. }
  301. - (TYCyclePagerViewLayout *)layoutForPagerView:(TYCyclePagerView *)pageView {
  302. CGFloat navHeight = [InstitutionNomalNavView getViewHeight];
  303. CGFloat searchHeight = [TenantDarkSearhView getViewHeight];
  304. CGFloat height = (KPortraitHeight - navHeight - searchHeight - kTabBarHeight - 16);
  305. TYCyclePagerViewLayout *layout = [[TYCyclePagerViewLayout alloc] init];
  306. CGFloat width = height / 571 * 296;
  307. layout.itemSize = CGSizeMake(width, height);
  308. layout.itemSpacing = 16.0f;
  309. layout.layoutType = TYCyclePagerTransformLayoutLinear;
  310. layout.sectionInset = UIEdgeInsetsMake(0, (KPortraitWidth - width) / 2.0f, 0, (KPortraitWidth - width) / 2.0f);
  311. return layout;
  312. }
  313. - (void)pagerView:(TYCyclePagerView *)pageView didSelectedItemCell:(__kindof UICollectionViewCell *)cell atIndex:(NSInteger)index {
  314. BOOL isLock = self.albumModel.status == YES ? NO : YES;
  315. if (isLock) {
  316. TenantAlbumModel *model = self.sourceArray[index];
  317. NSString *subjectType = model.subjectType;
  318. KSBaseWKWebViewController *ctrl = [[KSBaseWKWebViewController alloc] init];
  319. ctrl.url = [NSString stringWithFormat:@"%@%@?subjectType=%@&albumId=%@",TENANT_WEBHOST,@"/#/train-tool",subjectType,self.albumModel.internalBaseClassIdentifier];
  320. [self.navigationController pushViewController:ctrl animated:YES];
  321. }
  322. else { // 跳转到对应页面
  323. TenantAlbumModel *model = self.sourceArray[index];
  324. NSString *subjectType = model.subjectType;
  325. if ([subjectType isEqualToString:@"COURSEWARE"]) { // 云教程
  326. KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
  327. webCtrl.url = [NSString stringWithFormat:@"%@/#/lessonCourseware?albumId=%@", TENANT_WEBHOST, self.albumModel.internalBaseClassIdentifier];
  328. [self.navigationController pushViewController:webCtrl animated:YES];
  329. }
  330. else {
  331. KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
  332. webCtrl.url = [NSString stringWithFormat:@"%@/#/train-list?subjectType=%@&albumId=%@", TENANT_WEBHOST,subjectType, self.albumModel.internalBaseClassIdentifier];
  333. [self.navigationController pushViewController:webCtrl animated:YES];
  334. }
  335. }
  336. }
  337. - (void)pagerViewDidScroll:(TYCyclePagerView *)pageView {
  338. TenantHomeSubjectListCell *cell = (TenantHomeSubjectListCell *)[pageView curIndexCell];
  339. [cell stopAnimation];
  340. }
  341. - (void)pagerViewDidEndDecelerating:(TYCyclePagerView *)pageView {
  342. TenantHomeSubjectListCell *cell = (TenantHomeSubjectListCell *)[pageView curIndexCell];
  343. [cell startAnimation];
  344. }
  345. #pragma mark --- lazying
  346. - (NSMutableArray *)albumListArray {
  347. if (!_albumListArray) {
  348. _albumListArray = [NSMutableArray array];
  349. }
  350. return _albumListArray;
  351. }
  352. - (NSMutableArray *)animationNameArray {
  353. if (!_animationNameArray) {
  354. _animationNameArray = [NSMutableArray array];
  355. }
  356. return _animationNameArray;
  357. }
  358. -(TYCyclePagerView *)pagerView {
  359. if (!_pagerView) {
  360. _pagerView = [[TYCyclePagerView alloc] init];
  361. _pagerView.backgroundColor = [UIColor clearColor];
  362. _pagerView.isInfiniteLoop = NO;
  363. _pagerView.reloadDataNeedResetIndex = NO;
  364. _pagerView.delegate = self;
  365. _pagerView.dataSource = self;
  366. [_pagerView registerNib:[UINib nibWithNibName:@"TenantHomeSubjectListCell" bundle:nil] forCellWithReuseIdentifier:@"TenantHomeSubjectListCell"];
  367. if (@available(iOS 11.0, *)) {
  368. _pagerView.collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  369. } else {
  370. // Fallback on earlier versions
  371. if (@available(iOS 13.0, *)) {
  372. _pagerView.collectionView.automaticallyAdjustsScrollIndicatorInsets = NO;
  373. } else {
  374. // Fallback on earlier versions
  375. }
  376. }
  377. }
  378. return _pagerView;
  379. }
  380. - (InstitutionNomalNavView *)navView {
  381. if (!_navView) {
  382. _navView = [InstitutionNomalNavView shareInstance];
  383. MJWeakSelf;
  384. [_navView moreSwitch:^{
  385. [weakSelf switchAlbumAction];
  386. }];
  387. }
  388. return _navView;
  389. }
  390. - (void)switchAlbumAction {
  391. AlbumSwitchView *transferView = [AlbumSwitchView shareInstance];
  392. NSInteger lastChooseIndex = 0;
  393. for (NSInteger index = 0; index < self.albumListArray.count; index++) {
  394. GroupAlbumModel *model = self.albumListArray[index];
  395. model.isChoose = NO;
  396. if ([self.chooseAlbumId isEqualToString:model.internalBaseClassIdentifier]) {
  397. lastChooseIndex = index;
  398. }
  399. }
  400. [transferView albumChooseCallback:^(ALBUMSWITCH_TYPE type, NSInteger chooseIndex) {
  401. if (type == ALBUMSWITCH_TYPE_SWITCH) {
  402. GroupAlbumModel *model = self.albumListArray[chooseIndex];
  403. [self queryAlbumMessage:model.internalBaseClassIdentifier];
  404. }
  405. }];
  406. [transferView configWithSource:self.albumListArray lastChooseIndex:lastChooseIndex];
  407. [transferView showInDisplayView:self.view];
  408. }
  409. - (void)queryAlbumMessage:(NSString *)tenantAlbumId {
  410. // [LOADING_MANAGER showHUD];
  411. [KSNetworkingManager userBuyAlbumInfoDetailRequest:KS_GET tenantAlbumId:tenantAlbumId success:^(NSDictionary * _Nonnull dic) {
  412. // [LOADING_MANAGER removeHUD];
  413. if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
  414. NSDictionary *parm = [dic ks_dictionaryValueForKey:@"data"];
  415. GroupAlbumModel *model = [[GroupAlbumModel alloc] initWithDictionary:parm];
  416. [self refreshWithModel:model];
  417. [self.pagerView scrollToItemAtIndex:0 animate:NO];
  418. }
  419. else {
  420. }
  421. } faliure:^(NSError * _Nonnull error) {
  422. // [LOADING_MANAGER removeHUD];
  423. }];
  424. }
  425. /*
  426. - (void)switchMoreAction {
  427. if (self.callback) {
  428. self.callback();
  429. }
  430. }
  431. */
  432. - (TenantDarkSearhView *)searchView {
  433. if (!_searchView) {
  434. _searchView = [TenantDarkSearhView shareInstance];
  435. MJWeakSelf;
  436. [_searchView searchAction:^{
  437. [weakSelf showSearchView];
  438. }];
  439. }
  440. return _searchView;
  441. }
  442. - (void)showSearchView {
  443. KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
  444. webCtrl.url = [NSString stringWithFormat:@"%@/#/music-songbook/searchAlbum", TENANT_WEBHOST];
  445. [self.navigationController pushViewController:webCtrl animated:YES];
  446. }
  447. - (TenantDragView *)suspendButton {
  448. if (!_suspendButton) {
  449. _suspendButton = [[TenantDragView alloc] initWithFrame:CGRectMake(KPortraitWidth - TenantDragButtonWidth, KPortraitHeight - kTabBarHeight - TenantDragButtonHeight - 100, TenantDragButtonWidth, TenantDragButtonHeight)];
  450. MJWeakSelf;
  451. [_suspendButton clickAction:^{
  452. [weakSelf showDragWindowDetail];
  453. }];
  454. }
  455. return _suspendButton;
  456. }
  457. - (void)showDragWindowDetail {
  458. ToneTuningViewController *ctrl = [[ToneTuningViewController alloc] init];
  459. [self.navigationController pushViewController:ctrl animated:YES];
  460. }
  461. - (TenantDarkEmptyView *)emptyAniView {
  462. if (!_emptyAniView) {
  463. _emptyAniView = [TenantDarkEmptyView shareInstance];
  464. }
  465. return _emptyAniView;
  466. }
  467. - (dispatch_group_t)requestGroup {
  468. if (!_requestGroup) {
  469. _requestGroup = dispatch_group_create();
  470. }
  471. return _requestGroup;
  472. }
  473. - (void)setAlbumCount:(NSInteger)albumCount {
  474. _albumCount = albumCount;
  475. if (albumCount > 1) { // 显示切换
  476. self.navView.needSwitchButton = YES;
  477. }
  478. else { // 隐藏切换
  479. self.navView.needSwitchButton = NO;
  480. }
  481. }
  482. /*
  483. #pragma mark - Navigation
  484. // In a storyboard-based application, you will often want to do a little preparation before navigation
  485. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  486. // Get the new view controller using [segue destinationViewController].
  487. // Pass the selected object to the new view controller.
  488. }
  489. */
  490. @end