zoukankan      html  css  js  c++  java
  • 控制广告时间

    //  XMGAdViewController.m
    
    
    #import "XMGAdViewController.h"
    #import <AFNetworking/AFNetworking.h>
    #import "XMGADItem.h"
    #import <MJExtension/MJExtension.h>
    #import <UIImageView+WebCache.h>
    #import "XMGTabBarController.h"
    
    
    
    @interface XMGAdViewController ()
    @property (weak, nonatomic) IBOutlet UIImageView *launchImageView;
    @property (weak, nonatomic) IBOutlet UIView *adContainView;
    @property (nonatomic, weak) UIImageView *adView;
    @property (nonatomic, strong) XMGADItem *item;
    @property (nonatomic, weak) NSTimer *timer;
    @property (weak, nonatomic) IBOutlet UIButton *jumpBtn;
    @end
    
    @implementation XMGAdViewController
    
    // 点击跳转做的事情
    - (IBAction)clickJump:(id)sender {
        // 销毁广告界面,进入主框架界面
        XMGTabBarController *tabBarVc = [[XMGTabBarController alloc] init];
        [UIApplication sharedApplication].keyWindow.rootViewController = tabBarVc;
        
        // 干掉定时器
        [_timer invalidate];
    }
    
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view.
        // 设置启动图片
        [self setupLaunchImage];
        
        // 加载广告数据 => 拿到活时间 => 服务器 => 查看接口文档 1.判断接口对不对 2.解析数据(w_picurl,ori_curl:跳转到广告界面,w,h) => 请求数据(AFN)
        [self loadAdData];
        
        // 创建定时器
        _timer =  [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timeChange) userInfo:nil repeats:YES];
    }
    
    - (void)timeChange
    {
        // 倒计时
        static int i = 3;
        
        if (i == 0) {
        
            [self clickJump:nil];
            
        }
        
        i--;
        
        // 设置跳转按钮文字
        [_jumpBtn setTitle:[NSString stringWithFormat:@"跳转 (%d)",i] forState:UIControlStateNormal];
    }
    
    
    
    @end
  • 相关阅读:
    springCloud、springBoot学习
    企业级应用和互联网应用的去区别
    软件工程 期末总结
    四则运算
    读后感
    软件工程自评
    wc
    自我介绍
    学习javaE的目标
    基于Caffe的DeepID2实现(中)
  • 原文地址:https://www.cnblogs.com/xufengyuan/p/6556106.html
Copyright © 2011-2022 走看看