| | |
| | | |
| | | #import "RecommendController.h" |
| | | #import "ListController.h" |
| | | #import <BUAdSDK/BUAdSDK.h> |
| | | #import "DYGridVideoController.h" |
| | | |
| | | @interface RecommendMainController () <ZJScrollPageViewDelegate> |
| | | @interface RecommendMainController () <ZJScrollPageViewDelegate,BUNativeExpressFullscreenVideoAdDelegate> |
| | | |
| | | @property(nonatomic, nullable, strong) ZJScrollPageView *scrollPageView; |
| | | @property (nonatomic, strong) UIView *primtView; |
| | |
| | | @property (nonatomic, nullable, strong) NSMutableArray *arrayKeyName; |
| | | |
| | | @property (nonatomic, assign) BOOL isRequest; |
| | | |
| | | |
| | | @property (nonatomic, strong)BUNativeExpressFullscreenVideoAd *fullscreenAd; |
| | | @end |
| | | |
| | | @implementation RecommendMainController |
| | |
| | | } |
| | | |
| | | - (void)viewWillAppear:(BOOL)animated { |
| | | NSLog(@"RecommendMainController - viewWillAppear"); |
| | | [super viewWillAppear:animated]; |
| | | [self.navigationController setNavigationBarHidden:YES animated:animated]; |
| | | self.navigationController.navigationBar.translucent = NO; |
| | |
| | | } |
| | | |
| | | - (void)viewDidLoad { |
| | | NSLog(@"RecommendMainController - viewDidLoad"); |
| | | [super viewDidLoad]; |
| | | [self NetworkMonitoring]; |
| | | [self.view addSubview:self.primtView]; |
| | |
| | | for (int i = 0; i < [result[@"Data"][@"data"] count]; i++) { |
| | | [self.arrayClassName addObject:result[@"Data"][@"data"][i][@"Name"]]; |
| | | [self.arrayKeyName addObject:result[@"Data"][@"data"][i]]; |
| | | // if(i==0){ |
| | | // [self.arrayClassName addObject:@"刷一刷"]; |
| | | // [self.arrayKeyName addObject:@{@"Id":@123,@"DataType":@"gridVideo"}]; |
| | | // } |
| | | } |
| | | |
| | | |
| | | |
| | | self.primtView.hidden = YES; |
| | | [self setupViewConfig]; |
| | | self.isRequest = NO; |
| | |
| | | break; |
| | | case AFNetworkReachabilityStatusUnknown:{// 当前网络未知 |
| | | [YTHsharedManger startManger].NetworkStatus = 3; |
| | | |
| | | |
| | | } |
| | | break; |
| | | } |
| | |
| | | if ([type containsString:@"recommend"]) { |
| | | RecommendController *vc = [[RecommendController alloc] init]; |
| | | vc.parms = _arrayKeyName[index]; |
| | | vc.index = index; |
| | | childVc = vc; |
| | | |
| | | } else if ([type containsString:@"class"]) { |
| | | ListController *vc = [[ListController alloc] init]; |
| | | vc.parms = _arrayKeyName[index]; |
| | | childVc = vc; |
| | | }else if ([type containsString:@"gridVideo"]) { |
| | | DYGridVideoController *vc = [[DYGridVideoController alloc] init]; |
| | | childVc = vc; |
| | | } |
| | | } |
| | |
| | | return _primtView; |
| | | } |
| | | _primtView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; |
| | | // _primtView .backgroundColor = SJColor(98, 98,86 , 1); |
| | | // _primtView .backgroundColor = SJColor(98, 98,86 , 1); |
| | | _primtView.backgroundColor = [UIColor whiteColor]; |
| | | UIImageView *imageview = [[UIImageView alloc]initWithFrame:CGRectMake((KScreenW - KScreenW / 3) / 2, KScreenH / 2 - KScreenW / 3 , KScreenW / 3 , KScreenW / 3)]; |
| | | imageview.image = [UIImage imageNamed: @"nowifi"]; |
| | | // imageview.backgroundColor = [UIColor orangeColor]; |
| | | // imageview.backgroundColor = [UIColor orangeColor]; |
| | | [_primtView addSubview:imageview]; |
| | | |
| | | UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(imageview.frame), KScreenW , 30)]; |
| | |
| | | _primtView.hidden = YES; |
| | | return _primtView; |
| | | } |
| | | |
| | | |
| | | //加载插屏广告 |
| | | |
| | | - (void)loadFullscreenVideoAd { |
| | | id interstitial=[YTHsharedManger startManger].ad[@"homeInterstitial"]; |
| | | if(interstitial==nil|| interstitial==[NSNull null] ||interstitial[@"type"]==nil){ |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ |
| | | |
| | | NSLog(@"广告开始加载-首页插屏"); |
| | | self.fullscreenAd = [[BUNativeExpressFullscreenVideoAd alloc] initWithSlotID:@"947698171"]; |
| | | self.fullscreenAd.delegate = self; |
| | | [self.fullscreenAd loadAdData]; |
| | | |
| | | }); |
| | | |
| | | } |
| | | |
| | | //此方法在视频广告素材加载成功时调用。 |
| | | - (void)nativeExpressFullscreenVideoAdDidLoad:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd { |
| | | |
| | | } |
| | | |
| | | //当视频广告素材加载失败时调用此方法。 |
| | | - (void)nativeExpressFullscreenVideoAd:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd didFailWithError:(NSError *_Nullable)error { |
| | | |
| | | } |
| | | |
| | | //此方法在成功呈现nativeExpressAdView时调用。 |
| | | - (void)nativeExpressFullscreenVideoAdViewRenderSuccess:(BUNativeExpressFullscreenVideoAd *)rewardedVideoAd { |
| | | |
| | | } |
| | | |
| | | //当nativeExpressAdView无法呈现时,将调用此方法 |
| | | - (void)nativeExpressFullscreenVideoAdViewRenderFail:(BUNativeExpressFullscreenVideoAd *)rewardedVideoAd error:(NSError *_Nullable)error { |
| | | |
| | | } |
| | | //当视频缓存成功时调用此方法 |
| | | - (void)nativeExpressFullscreenVideoAdDidDownLoadVideo:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd { |
| | | [fullscreenVideoAd showAdFromRootViewController:self]; |
| | | } |
| | | |
| | | //此方法在用户单击“跳过”按钮时调用 |
| | | - (void)nativeExpressFullscreenVideoAdDidClickSkip:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd { |
| | | |
| | | } |
| | | |
| | | //此方法在视频广告即将关闭时调用。 |
| | | - (void)nativeExpressFullscreenVideoAdWillClose:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd { |
| | | |
| | | } |
| | | |
| | | //关闭视频广告时调用此方法 |
| | | - (void)nativeExpressFullscreenVideoAdDidClose:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd { |
| | | |
| | | } |
| | | |
| | | //此方法在视频广告播放完成或发生错误时调用。 |
| | | - (void)nativeExpressFullscreenVideoAdDidPlayFinish:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd didFailWithError:(NSError *_Nullable)error { |
| | | |
| | | |
| | | } |
| | | |
| | | @end |