iOS - 如何在LeadBolt sdk中设置广告的刷新率

时间:2012-04-01 22:26:57

标签: iphone ios advertising leadbolt

当我的应用加载时,它会为整个会话显示相同的横幅广告。是否有一种在新广告中循环的方法,例如刷新当前横幅以显示下一个广告?这会扼杀我的印象和转化。正如展示的一个广告所示,整个会话对用户来说并没有太大的吸引力。我知道通过阅读文档,loadAd()与它有关,但我似乎无法弄清楚如何实际实现该时间间隔。这是我的代码,目前正在使用带有leadbolt的视图我在横幅中显示横幅。这是 - (void)viewDidLoad的所有部分,我只是遗漏了与广告无关的所有其他内容。

    overlay = [[UIWebView alloc] initWithFrame:CGRectZero];
    titleBar = [[UIToolbar alloc] initWithFrame:CGRectZero];
    footerBar = [[UIToolbar alloc] initWithFrame:CGRectZero];
    clickTitleBar = [[UIToolbar alloc] initWithFrame:CGRectZero];
    clickFooterBar = [[UIToolbar alloc] initWithFrame:CGRectZero];
    mask = [[UIView alloc] initWithFrame:CGRectZero];

    [self.view insertSubview:mask atIndex:2];
    [self.view insertSubview:clickTitleBar atIndex:3];
    [self.view insertSubview:clickFooterBar atIndex:4];
    [self.view insertSubview:titleBar atIndex:5];
    [self.view insertSubview:footerBar atIndex:6];
    [self.view insertSubview:overlay atIndex:7];
    overlay.delegate = overlayController;

    //initialize the overlayController 
    overlayController  = [[LeadboltOverlay alloc] init];

    [overlayController setSectionid:@"MY AD #"];
    [overlayController setAdWebView:self.overlay];
    [overlayController setCloseBar:self.titleBar];
    [overlayController setFooterBar:self.footerBar];
    [overlayController setClickCloseBar:self.clickTitleBar];
    [overlayController setClickFooterBar:self.clickFooterBar];
    [overlayController setLocationControl:@"0"];
    [overlayController setMask:self.mask];

    ///////This part here?///////
    [overlayController loadAd];
    /////////////////////////////

    overlay.delegate = overlayController;

    self.stsTimer = [NSTimer timerWithTimeInterval:3.0 target:self selector:@selector(checkCompleted) userInfo:nil repeats:YES];
    [[NSRunLoop currentRunLoop] addTimer:self.stsTimer forMode:NSDefaultRunLoopMode];

1 个答案:

答案 0 :(得分:2)

要刷新广告(可能每分钟或每次在UI中有活动),您只需在UIWebView中设置HTML横幅,并在每次要显示新广告时调用myWebview重新加载。

不建议重复[overlayController loadAd],因为它可能导致内存管理问题。

相关问题