I am new to Adwhirl and am having some problems. I am setting my mainScreen controller as the delegate for AdView. While I am in this view, the ads refresh just fine. When I switch to another view though, the delegate no longer received any new ads(the delegates selectors are not fired). Is there a reason for this? I want one adView for my whole app, so I am passing a pointer around to it everywhere and adding it as a subview to the proper view.
Here is some code:
#pragma mark AdWhirl required delegate methods
- (NSString *)adWhirlApplicationKey {
return MY_AD_WHIRL_APPLICATION_KEY;
}
- (UIViewController *)viewControllerForPresentingModalView {
return self;
}
- (void)adWhirlDidReceiveAd:(AdWhirlView *)adWhirlView {
adView.hidden = NO;
if (self.view.window) {
[UIView beginAnimations:@"AdWhirlDelegate.adWhirlDidReceiveAd:"
context:nil];
[UIView setAnimationDuration:0.7];
CGSize adSize = [adView actualAdSize];
CGRect newFrame = adView.frame;
newFrame.size = adSize;
newFrame.origin.x = (self.view.bounds.size.width - adSize.width)/ 2;
newFrame.origin.y = self.view.bounds.size.height - 50;
adView.frame = newFrame;
[UIView commitAnimations];
}else {
[UIView beginAnimations:@"AdWhirlDelegate.adWhirlDidReceiveAd:"
context:nil];
[UIView setAnimationDuration:0.7];
CGSize adSize = [adView actualAdSize];
CGRect newFrame = adView.frame;
newFrame.size = adSize;
newFrame.origin.x = (self.view.bounds.size.width - adSize.width)/ 2;
//newFrame.origin.y = self.view.bounds.size.height - 50;
adView.frame = newFrame;
[UIView commitAnimations];
}
}
-(void)adWhirlDidFailToReceiveAd:(AdWhirlView *)adWhirlView usingBackup:(BOOL)yesOrNo
{
adView.hidden = YES;
}
Note: The mainScreen controller is the one my app starts with..so it is always resident in memory. This is responsible for pushing the other views on screen. Am I missing something to get this working?