NewestViewController.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. //
  2. // NewestViewController.m
  3. // FanweApp
  4. //
  5. // Created by fanwe2014 on 16/7/4.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "NewestViewController.h"
  9. #import "cuserModel.h"
  10. #import "LivingModel.h"
  11. #import "HMHotModel.h"
  12. #import "OneSectionCell.h"
  13. #import "WebModels.h"
  14. #import <QMapKit/QMapKit.h>
  15. #import <QMapSearchKit/QMapSearchKit.h>
  16. #import "DistanceModel.h"
  17. #import "NewestItemCell.h"
  18. #import "SDCycleScrollView.h"
  19. #import "AdJumpViewModel.h"
  20. //富豪榜
  21. //#import "MGRecommdHeadView.h"
  22. #import "BogoHomeSubTitleView.h"
  23. NS_ENUM(NSInteger ,NewEstiewTableView)
  24. {
  25. FWNewEstFirstSection, //直播间的画面
  26. FWNewEstTab_Count,
  27. };
  28. // 广告图默认滚动时间
  29. static float const bannerAutoScrollTimeInterval = 7;
  30. static NSString *firstHeaderViewIdentifier = @"firstHederview";
  31. static NSString *secondHeaderViewIdentifier = @"secondHederview";
  32. @interface NewestViewController ()<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,SDCycleScrollViewDelegate>
  33. @property ( nonatomic,strong) UICollectionView *collectionView; //CollectionView
  34. @property ( nonatomic,strong) UICollectionViewFlowLayout *layout;
  35. @property ( nonatomic,assign) int page;
  36. @property ( nonatomic,assign) int has_next;
  37. @property ( nonatomic,strong) NSMutableArray *dataArray; //数据源
  38. @property ( nonatomic,strong) NSMutableArray *recommandArr; //数据源
  39. @property ( nonatomic,strong) NSMutableArray *titleArray;
  40. //@property ( nonatomic,strong) UIView *NoThingView;
  41. @property (nonatomic, strong) SDCycleScrollView *cycleScrollView;
  42. @property (nonatomic, strong) NSMutableArray *bannArr;
  43. @property(nonatomic, strong) BogoHomeSubTitleView *headView;
  44. @property(nonatomic, strong) QMUIButton *firstBtn;
  45. @property(nonatomic, strong) QMUIButton *secondBtn;
  46. //@property(nonatomic, strong) UILabel *secondL;
  47. @property(nonatomic, assign) BOOL isClicking;
  48. @end
  49. @implementation NewestViewController
  50. -(SDCycleScrollView *)cycleScrollView{
  51. if (!_cycleScrollView) {
  52. _cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(10, 0, kScreenW - 20, kRealValue(97)) delegate:self placeholderImage:nil];
  53. self.cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
  54. self.cycleScrollView.currentPageDotColor = kAppMainColor; // 自定义分页控件小圆标颜色
  55. self.cycleScrollView.autoScrollTimeInterval = bannerAutoScrollTimeInterval;
  56. self.cycleScrollView.backgroundColor = kWhiteColor;
  57. self.cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
  58. self.cycleScrollView.layer.cornerRadius = 10;
  59. self.cycleScrollView.clipsToBounds = YES;
  60. }
  61. return _cycleScrollView;
  62. }
  63. -(QMUIButton *)firstBtn{
  64. if (!_firstBtn) {
  65. _firstBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  66. _firstBtn.titleLabel.font = [UIFont boldSystemFontOfSize:18];
  67. _firstBtn.frame = CGRectMake(kRealValue(15), self.headView.bottom, kScreenW * 0.8, kRealValue(55));
  68. [_firstBtn setTitle:ASLocalizedString(@"推荐主播") forState:UIControlStateNormal];
  69. [_firstBtn setTitleColor:[UIColor colorWithHexString:@"#333333"] forState:UIControlStateNormal];
  70. [_firstBtn setImage:[UIImage imageNamed:@"bogo_home_top_recommand"] forState:UIControlStateNormal];
  71. _firstBtn.spacingBetweenImageAndTitle = 2;
  72. if(self.view.isRTL)
  73. {
  74. _firstBtn.imagePosition = QMUIButtonImagePositionRight;
  75. _firstBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
  76. }
  77. else
  78. {
  79. _firstBtn.imagePosition = QMUIButtonImagePositionLeft;
  80. _firstBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  81. }
  82. // _firstBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  83. }
  84. return _firstBtn;
  85. }
  86. -(QMUIButton *)secondBtn{
  87. if (!_secondBtn) {
  88. _secondBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  89. _secondBtn.frame = CGRectMake(kRealValue(15), 0, kScreenW * 0.5, kRealValue(55));
  90. _secondBtn.titleLabel.font = [UIFont systemFontOfSize:18];
  91. [_secondBtn setTitle:ASLocalizedString(@"热门主播") forState:UIControlStateNormal];
  92. [_secondBtn setTitleColor:[UIColor colorWithHexString:@"#333333"] forState:UIControlStateNormal];
  93. [_secondBtn setImage:[UIImage imageNamed:@"bogo_home_top_recommand"] forState:UIControlStateNormal];
  94. _secondBtn.spacingBetweenImageAndTitle = 2;
  95. _secondBtn.imagePosition = QMUIButtonImagePositionLeft;
  96. _secondBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  97. // UIControlContentHorizontalAlignmentLeft;
  98. }
  99. return _secondBtn;
  100. }
  101. -(BogoHomeSubTitleView *)headView{
  102. if (!_headView) {
  103. _headView = [[BogoHomeSubTitleView alloc]initWithFrame:CGRectMake(0, self.cycleScrollView.bottom + 5, kScreenW, kRealValue(56))];
  104. }
  105. return _headView;
  106. }
  107. - (void)viewDidLoad
  108. {
  109. [super viewDidLoad];
  110. self.automaticallyAdjustsScrollViewInsets = NO;
  111. }
  112. - (void)viewWillAppear:(BOOL)animated
  113. {
  114. [super viewWillAppear:animated];
  115. self.navigationController.navigationBar.hidden = NO;
  116. // [GlobalVariables sharedInstance].appModel.open_noble = @"1";
  117. }
  118. - (void)initFWUI
  119. {
  120. [super initFWUI];
  121. self.navigationController.navigationBar.hidden = YES;
  122. self.automaticallyAdjustsScrollViewInsets = NO;
  123. self.edgesForExtendedLayout = UIRectEdgeNone;
  124. self.view.translatesAutoresizingMaskIntoConstraints = NO;
  125. _collectionView.translatesAutoresizingMaskIntoConstraints = NO;
  126. _dataArray = [[NSMutableArray alloc]init];
  127. _recommandArr = [[NSMutableArray alloc]init];
  128. _titleArray = [[NSMutableArray alloc]init];
  129. [self creatView];
  130. _isClicking = NO;
  131. }
  132. - (void)initFWData
  133. {
  134. [super initFWData];
  135. [self loadDataWithPage:1];
  136. }
  137. #pragma mark 创建UICollectionView
  138. - (void)creatView
  139. {
  140. _layout = [[UICollectionViewFlowLayout alloc]init];
  141. _layout.scrollDirection = UICollectionViewScrollDirectionVertical;
  142. if ([self.types isEqualToString:@"1"]) { _layout.headerReferenceSize=CGSizeMake(self.view.frame.size.width,self.cycleScrollView.height + 10); //设置collectionView头视图的大小
  143. _layout.itemSize = CGSizeMake((kScreenW-30)/2.0f,(kScreenW-30)/2.0f);
  144. }else{
  145. _layout.minimumInteritemSpacing = 3;
  146. _layout.minimumLineSpacing = 3;
  147. _layout.itemSize = CGSizeMake((kScreenW-3)/2,(kScreenW-3)/2);
  148. }
  149. CGRect tmpFrame;
  150. if (_collectionViewFrame.size.height)
  151. {
  152. // tmpFrame = _collectionViewFrame;
  153. tmpFrame = CGRectMake(0, 0, kScreenW, _collectionViewFrame.size.height - self.headView.height);
  154. }
  155. else
  156. {
  157. tmpFrame = CGRectMake(0, 0, kScreenW, kScreenH - kRealValue(120) - kTabBarHeight - MG_BOTTOM_MARGIN);
  158. // kStatusBarHeight-kTabBarHeight - 22 - 50 + MG_BOTTOM_MARGIN);
  159. }
  160. _collectionView = [[UICollectionView alloc]initWithFrame:tmpFrame collectionViewLayout:_layout];
  161. // [_collectionView registerClass:[OneSectionCell class] forCellWithReuseIdentifier:@"OneSectionCell"];
  162. [_collectionView registerNib:[UINib nibWithNibName:@"NewestItemCell" bundle:nil] forCellWithReuseIdentifier:@"NewestItemCell"];
  163. [_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:firstHeaderViewIdentifier];
  164. [_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:secondHeaderViewIdentifier];
  165. _collectionView.backgroundColor = kClearColor;
  166. _collectionView.dataSource = self;
  167. _collectionView.delegate = self;
  168. _collectionView.showsHorizontalScrollIndicator = NO;
  169. [self.view addSubview:_collectionView];
  170. //刷新该页面(主要为了删除最新页已经退出的直播间)
  171. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshHome:) name:@"refreshHome" object:nil];
  172. [BGMJRefreshManager refresh:_collectionView target:self headerRereshAction:@selector(headerReresh) shouldHeaderBeginRefresh:NO footerRereshAction:@selector(footerReresh)];
  173. }
  174. #pragma mark ==========================通知==========================
  175. - (void)refreshHome:(NSNotification *)noti
  176. {
  177. if (noti)
  178. {
  179. NSDictionary *tmpDict = (NSDictionary *)noti.object;
  180. NSString *room_id = [tmpDict toString:@"room_id"];
  181. @synchronized (_dataArray)
  182. {
  183. NSMutableArray *tmpArray = _dataArray;
  184. for (LivingModel *model in tmpArray)
  185. {
  186. if (model.room_id == [room_id intValue])
  187. {
  188. [tmpArray removeObject:model];
  189. _dataArray = tmpArray;
  190. [_collectionView reloadData];
  191. return;
  192. }
  193. }
  194. }
  195. }
  196. }
  197. #pragma mark 头部刷新
  198. - (void)headerReresh
  199. {
  200. [self loadDataWithPage:1];
  201. }
  202. #pragma mark 尾部刷新
  203. - (void)footerReresh
  204. {
  205. if (_has_next == 1)
  206. {
  207. _page ++;
  208. [self loadDataWithPage:_page];
  209. }
  210. else
  211. {
  212. [BGMJRefreshManager endRefresh:_collectionView];
  213. }
  214. }
  215. #pragma mark 网络加载
  216. - (void)loadDataFromNet:(int)page{
  217. [self loadDataWithPage:page];
  218. }
  219. - (void)loadDataWithPage:(int)page
  220. {
  221. //全部主播
  222. self.bannArr = @[];
  223. NSMutableDictionary *parmDict = [NSMutableDictionary dictionary];
  224. if ([self.types isEqualToString:@"1"]){
  225. // || [self.types isEqualToString:@"2"]) {
  226. [parmDict setObject:@"index" forKey:@"ctl"];
  227. [parmDict setObject:@"index" forKey:@"act"];
  228. if (![BGUtils isBlankString:_sexString])
  229. {
  230. [parmDict setObject:_sexString forKey:@"sex"];
  231. }
  232. if (![BGUtils isBlankString:_areaString])
  233. {
  234. [parmDict setObject:_areaString forKey:@"city"];
  235. }
  236. if (![BGUtils isBlankString:self.cate_id])
  237. {
  238. [parmDict setObject:self.cate_id forKey:@"cate_id"];
  239. }
  240. }else if ([self.types isEqualToString:@"2"]){
  241. [parmDict setObject:@"index" forKey:@"ctl"];
  242. [parmDict setObject:@"new_video" forKey:@"act"];
  243. }
  244. else{
  245. }
  246. [parmDict setObject:[NSString stringWithFormat:@"%d",page] forKey:@"p"];
  247. [self.httpsManager POSTWithParameters:parmDict SuccessBlock:^(NSDictionary *responseJson)
  248. {
  249. if ([responseJson toInt:@"status"] == 1)
  250. {
  251. _has_next = [responseJson toInt:@"has_next"];
  252. _page = [responseJson toInt:@"page"];
  253. if (_page == 1)
  254. {
  255. [_dataArray removeAllObjects];
  256. [_titleArray removeAllObjects];
  257. [_recommandArr removeAllObjects];
  258. }
  259. //直播数组
  260. NSArray *listArray = [responseJson objectForKey:@"list"];
  261. NSArray *bannArr = [responseJson objectForKey:@"banner"];
  262. NSArray *recommandArr = [responseJson objectForKey:@"recommend_list"];
  263. NSMutableArray *tmpMArray = [NSMutableArray array];
  264. self.bannArr = [NSMutableArray array];
  265. for (NSDictionary *dic in bannArr)
  266. {
  267. HMHotBannerModel *bannerModel = [HMHotBannerModel mj_objectWithKeyValues:dic];
  268. [self.bannArr addObject:bannerModel];
  269. [tmpMArray addObject:bannerModel.image];
  270. // [tmpMArray addObject:[dic valueForKey:@"image"]];
  271. }
  272. // 加载延迟
  273. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  274. self.cycleScrollView.imageURLStringsGroup = tmpMArray;
  275. });
  276. //推荐主播
  277. // NSMutableArray *recommadList = [[NSMutableArray alloc]init];
  278. if (recommandArr && [recommandArr isKindOfClass:[NSArray class]])
  279. {
  280. if (recommandArr.count > 0)
  281. {
  282. for (NSDictionary *dict in recommandArr)
  283. {
  284. LivingModel *model = [LivingModel mj_objectWithKeyValues:dict];
  285. model.xponit = [dict toFloat:@"xpoint"];
  286. model.yponit = [dict toFloat:@"ypoint"];
  287. [self.recommandArr addObject:model];
  288. }
  289. }
  290. }
  291. //全部主播
  292. NSMutableArray *listMArray = [[NSMutableArray alloc]init];
  293. if (listArray && [listArray isKindOfClass:[NSArray class]])
  294. {
  295. if (listArray.count > 0)
  296. {
  297. for (NSDictionary *dict in listArray)
  298. {
  299. LivingModel *model = [LivingModel mj_objectWithKeyValues:dict];
  300. model.xponit = [dict toFloat:@"xpoint"];
  301. model.yponit = [dict toFloat:@"ypoint"];
  302. [listMArray addObject:model];
  303. }
  304. }
  305. }
  306. QMapPoint point1 = QMapPointForCoordinate(CLLocationCoordinate2DMake(self.BuguLive.longitude,self.BuguLive.latitude));
  307. DistanceModel *distanceModel = [[DistanceModel alloc]init];
  308. if([self.types isEqualToString:@"1"])
  309. {
  310. _dataArray = listMArray;
  311. }
  312. else
  313. {
  314. if (listMArray.count)
  315. {
  316. _dataArray = [distanceModel CalculateDistanceWithArray:listMArray andPoint:point1];
  317. }
  318. }
  319. [_collectionView reloadData];
  320. // if (!_dataArray.count)
  321. // {
  322. // [self showNoContentView];
  323. // // self.NoThingView.hidden = NO;
  324. // }else
  325. // {
  326. [self hideNoContentView];
  327. // self.NoThingView.hidden = YES;
  328. // }
  329. }
  330. [BGMJRefreshManager endRefresh:_collectionView];
  331. } FailureBlock:^(NSError *error)
  332. {
  333. [BGMJRefreshManager endRefresh:_collectionView];
  334. }];
  335. }
  336. // 返回头视图
  337. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
  338. {
  339. //如果是头视图
  340. if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
  341. if (indexPath.section == 0) {
  342. UICollectionReusableView *header=[collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:firstHeaderViewIdentifier forIndexPath:indexPath];
  343. //头视图添加view
  344. // if (!_firstL) {
  345. // self.firstBtn.frame = CGRectMake(kRealValue(15), self.headView.bottom, kScreenW * 0.5, kRealValue(55));
  346. self.firstBtn.top = self.headView.bottom;
  347. self.secondBtn.top = self.cycleScrollView.bottom;
  348. [header addSubview:self.cycleScrollView];
  349. [header addSubview:self.headView];
  350. [header addSubview:self.firstBtn];
  351. // _firstBtn.frame = CGRectMake(kRealValue(15), self.headView.bottom, kScreenW * 0.8, kRealValue(55));
  352. //使用Masonry适配RTL
  353. [_firstBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  354. make.top.equalTo(self.headView.mas_bottom).offset(15);
  355. make.leading.equalTo(self.headView).offset(15);
  356. make.width.equalTo(@(kScreenW * 0.8));
  357. make.height.equalTo(@55);
  358. }];
  359. if (kIsCheckingVersion() || ![self.types isEqualToString:@"1"]) {
  360. self.headView.hidden = self.firstBtn.hidden = YES;
  361. }
  362. return header;
  363. }
  364. else if (indexPath.section == 1) {
  365. UICollectionReusableView *header=[collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:secondHeaderViewIdentifier forIndexPath:indexPath];
  366. header.hidden = YES;
  367. //头视图添加view
  368. // if (!_secondL) {
  369. // [header addSubview:self.secondBtn];
  370. // if (![self.types isEqualToString:@"1"]) {
  371. // self.secondBtn.hidden = YES;
  372. // self.cycleScrollView.hidden = YES;
  373. // }
  374. // }
  375. return header;
  376. }
  377. }
  378. return nil;
  379. }
  380. #pragma mark UICollectionViewDataSource UICollectionViewDelegate
  381. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
  382. {
  383. return 2;
  384. // FWNewEstTab_Count;
  385. }
  386. -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{
  387. if (![self.types isEqualToString:@"1"]) {
  388. return CGSizeMake(0, 0);;
  389. // return CGSizeMake(kScreenW, kRealValue(120));
  390. }
  391. if (section == 0) {
  392. if (kIsCheckingVersion() || ![self.types isEqualToString:@"1"]) {
  393. return CGSizeMake(0, 0);
  394. }
  395. return CGSizeMake(kScreenW, self.firstBtn.bottom - 10);
  396. }
  397. return CGSizeMake(kScreenW, 1);
  398. }
  399. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
  400. {
  401. if (section == 0) {
  402. if (![self.types isEqualToString:@"1"]) {
  403. return 0;
  404. }
  405. return self.recommandArr.count;
  406. }else{
  407. return _dataArray.count;
  408. }
  409. }
  410. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  411. {
  412. if (indexPath.section == 0) {
  413. NewestItemCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"NewestItemCell" forIndexPath:indexPath];
  414. cell.backgroundColor = [UIColor clearColor];
  415. if (_recommandArr.count > 0) {
  416. LivingModel *LModel = _recommandArr[indexPath.row];
  417. [cell setCellContent:LModel Type:[self.types intValue]];
  418. }
  419. return cell;
  420. }else{
  421. NewestItemCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"NewestItemCell" forIndexPath:indexPath];
  422. cell.backgroundColor = [UIColor clearColor];
  423. if (_dataArray.count > 0) {
  424. LivingModel *LModel = _dataArray[indexPath.row];
  425. [cell setCellContent:LModel Type:[self.types intValue]];
  426. }
  427. return cell;
  428. }
  429. }
  430. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
  431. // if ([_types isEqualToString:@"1"] || [_types isEqualToString:@"2"]) {
  432. return CGSizeMake((kScreenW-30)/2.0f, (kScreenW-30) / 2.0f + kRealValue(32));
  433. // }
  434. // return CGSizeMake((kScreenW-3)/2, (kScreenW-3)/2 + kRealValue(32));
  435. }
  436. - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{
  437. return 0;
  438. }
  439. - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
  440. {
  441. if ([_types isEqualToString:@"1"] ) {
  442. return UIEdgeInsetsMake(10, 10, 10, 10);
  443. }
  444. if ( [_types isEqualToString:@"2"]) {
  445. return UIEdgeInsetsMake(0, 10, 10, 10);
  446. }
  447. return UIEdgeInsetsMake(0, 0, 0, 0);
  448. }
  449. #pragma mark 跳转到在线直播
  450. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
  451. {
  452. if (_isClicking) {
  453. return;
  454. }
  455. _isClicking = YES;
  456. // 1 秒后将 _isClicking 置为 NO
  457. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  458. self->_isClicking = NO;
  459. });
  460. LivingModel *model;
  461. if (indexPath.section == 0) {
  462. model = _recommandArr[indexPath.row];
  463. }else{
  464. model = _dataArray[indexPath.row];
  465. }
  466. if (self.delegate)
  467. {
  468. if ([self.delegate respondsToSelector:@selector(pushToLiveController:modelArr:isFirstJump:)])
  469. {
  470. [self.delegate pushToLiveController:model modelArr:self.dataArray isFirstJump:YES];
  471. }
  472. }
  473. }
  474. #pragma mark 跳转到直播的tableView
  475. - (void)GotoNextViewWithBlockTag:(int)tag
  476. {
  477. cuserModel *model = _titleArray[tag];
  478. if (self.delegate)
  479. {
  480. if ([self.delegate respondsToSelector:@selector(pushToNextControllerWithModel:)])
  481. {
  482. [self.delegate pushToNextControllerWithModel:model];
  483. }
  484. }
  485. }
  486. -(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
  487. HMHotBannerModel *hotBannerModel = [self.bannArr objectAtIndex:index];
  488. if ([AdJumpViewModel adToOthersWith:hotBannerModel])
  489. {
  490. [[AppDelegate sharedAppDelegate]pushViewController:[AdJumpViewModel adToOthersWith:hotBannerModel] animated:YES];
  491. }
  492. }
  493. @end