0

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.

Oleg Trakhman
  • 2,082
  • 1
  • 17
  • 35

2 Answers2

1

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;
NikGreen
  • 700
  • 9
  • 28
  • I did it this way, and it worked, but there was a problem: when ads unavailale for some reason (no internet) button hovers over screen. It looks odd when button appear without ad. – Oleg Trakhman Jul 12 '12 at 11:27
0

Try this:

  [adWhirlView bringSubviewToFront:button];
Paresh Navadiya
  • 38,095
  • 11
  • 81
  • 132