Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

requiredContentSizeIdentifiers is deprecated [duplicate]

my code is

    -(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;
    }
}

The code

currentContentSizeIdentifier

requiredContentSizeIdentifiers

ADBannerContentSizeIdentifierPortrait

is deprecated, so what do I replace it with, so it will still work?

I need to do this before I submit it, because if I don't, the app will get rejected.

Please help me

Thanks in Advance

like image 547
user2167312 Avatar asked Mar 19 '13 23:03

user2167312


1 Answers

If you remove the offending lines of code and implement the one below, it will achieve the same result but it is not deprecated.

Remove:

adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier =ADBannerContentSizeIdentifierPortrait;

Add:

[adView setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
like image 84
JeffN Avatar answered Sep 22 '22 12:09

JeffN