我正在为 iOS 开发 dict,并尝试使用 iAd 获利。我逐步完成了示例,除了创建广告视图,但广告显示不正确。
我的代码:
- (void)viewDidLoad
{
adView.frame = CGRectOffset(adView.frame, 0, -50); //don't work
adView.delegate=self;
self.bannerIsVisible=NO;
[super viewDidLoad];
}
-(void)bannerViewDidLoadAd:(ADBannerView *)banner{
if (!self.bannerIsVisible){
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0, 50); //works well
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{
if (self.bannerIsVisible){
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0, -50);
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}
我使用故事板,使用自动布局,尝试设置
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
没有任何帮助。