All Articles

Animate an AdWhirlView from the Bottom of the Screen

If you are using AdWhirl and want the ad to slide in from the bottom of the screen when your View loads, use this snippet:

- (void)viewDidLoad
    [super viewDidLoad];
    AdWhirlView *adWhirlView = [AdWhirlView requestAdWhirlViewWithDelegate:self];
    adWhirlView.delegate = self;
    adWhirlView.frame = CGRectMake(0, 430+kAdWhirlViewHeight, kAdWhirlViewWidth, kAdWhirlViewHeight);
    [self.parentViewController.view insertSubview:adWhirlView belowSubview:self.view];

    [UIView beginAnimations:@"AdWhirlIn" context:nil];
    [UIView setAnimationDuration:.5];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    adWhirlView.frame = CGRectMake(0, 430, kAdWhirlViewWidth, kAdWhirlViewHeight);
    [UIView commitAnimations];
Published 18 Aug 2012

Code. Comics. Crossfit
Tim Broder on Twitter