ioscocoa-touchadwhirl

Adding a UIButton to AdWhirl ad banner


How to add a UIButton to AdWhirl ad banner? Trivial [adWhirlView addSubview: button] doesn't work. Button doesn't appear.

UPD Already tried:

[view addSubview:adWhirlView];
[adWhirlView addSubview:button];
[adWhirlView bringSubviewToFront:button];

adWhirlView is visible, but not the button.


Solution

  • Why don't you try to add the button and AdWhirl view to the same parent view? Something like this:

    [view addSubview: adWhirlView];
    [view addSubview: button];
    

    It will be same view hierarchy you pursue, in my opinion. You will only need to position the button the way you want.

    UPD: If the AdWhirl fails to receive ads, it fires the delegate method:

    -(void)adWhirlDidFailToReceiveAd:(AdWhirlView *)adWhirlView usingBackup:(BOOL)yesOrNo
    

    So you can toggle the visibility of your button using AdWhirl didReceive/didFail methods. Start with adding a hidden button, then on didReceive: set

    button.hidden = NO;
    

    and on didFail:

    button.hidden = YES;