我的代码是
-(void)viewDidLoad
{
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.frame = CGRectOffset(adView.frame, 0, -50);
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier =ADBannerContentSizeIdentifierPortrait;
[self.view addSubview:adView];
adView.delegate=self;
self.bannerIsVisible=NO;
[super viewDidLoad];
}
//when banner is loaded successfully
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
if (!self.bannerIsVisible)
{
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
// banner is invisible now and moved out of the screen on 50 px
banner.frame = CGRectOffset(banner.frame, 0, 50);
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
//when any problems occured
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
if (self.bannerIsVisible)
{
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
// banner is visible and we move it out of the screen, due to connection issue
banner.frame = CGRectOffset(banner.frame, 0, -50);
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}
代码
currentContentSizeIdentifier
requiredContentSizeIdentifiers
ADBannerContentSizeIdentifierPortrait
已被弃用,那么我该如何替换它,所以它仍然可以使用?
我需要在提交之前执行此操作,因为如果我不这样做,应用程序将被拒绝。
请帮帮我
先谢谢
答案 0 :(得分:12)
如果删除有问题的代码行并实现下面的代码,它将获得相同的结果,但不会弃用。
卸下:
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier =ADBannerContentSizeIdentifierPortrait;
添加:
[adView setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
答案 1 :(得分:0)
iOS 6附带了许多新的更新。有许多自动调整大小控件已被弃用。 ADBannerContentSizeIdentifierPortrait
也已弃用。
这是帮助您解决此问题的链接。