【问题标题】:How to load interstitial ads when Navigation Back Button Pressed and Some Click Event? [closed]按下导航返回按钮和一些点击事件时如何加载插页式广告? [关闭]
【发布时间】:2014-12-22 10:28:41
【问题描述】:

我是 iOS 开发新手。我在ViewDidLoad 时添加了插页式广告,但我想在用户在我的应用程序中点击十次时显示插页式广告,这可能吗?如果可能的话,请帮助我找到解决方案。我的应用程序包含HMSegmentedControll,它有十个不同的UITableView。而且我还想在按下NavigationBar 后退按钮时显示这些广告。谁能帮我解决这个问题?

【问题讨论】:

    标签: ios objective-c uitableview uinavigationcontroller interstitial


    【解决方案1】:

    可以像 Android 中的 SharedPreference 一样

    制作一个全局变量 NSObject 像 as

    GlobalVariable.h文件

    @property (assign) int touchCount;
    + (TouchCount *)getInstance;
    @end
    

    GlobalVariable.m文件

    @synthesize touchCount;
    static TouchCount *instance = nil;
    
    +(TouchCount *)getInstance
    {
    @synchronized(self)
    {
        if(instance==nil)
        {
            instance= [TouchCount new];
        }
        if (instance.touchCount ==10)
        {
            instance.touchCount=0;
            instance= [TouchCount new];
        }
    }
    return instance;
    }
    

    当你想触摸时使用这个实例 Count import GLobalVariable.hlike as

    TouchCount *obj=[TouchCount getInstance];
    

    【讨论】:

      【解决方案2】:

      你可以添加一些全局价值而不是计算“回击”

      在 GlobalVariables.h 文件中是这样的:

       extern int PRJ_back_touches_count;
      

      .m:

       int PRJ_back_touches_count;
      

      比例如在 viewWillDisappear 方法 PRJ_back_touches_count++

      在 viewDidAppear 上你可以处理 PRJ_back_touches_count 实际值

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多