2013-03-19 29 views
6

mój kod jestrequiredContentSizeIdentifiers jest przestarzała

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

Kod

currentContentSizeIdentifier 

requiredContentSizeIdentifiers 

ADBannerContentSizeIdentifierPortrait 

jest przestarzała, więc co mogę zastąpić go, więc będzie nadal działać?

Muszę to zrobić przed przesłaniem, ponieważ w przeciwnym razie aplikacja zostanie odrzucona.

Jeśli usunąć wiersze naruszające kodu i wdrożenie jednego poniżej Proszę mi pomóc

z góry dzięki

+0

Mówiłeś, że jest to duplikat pytanie, ale moje pytanie nie odpowiedział – user2167312

Odpowiedz

12

będzie osiągnąć ten sam wynik, ale nie jest to zalecane.

Usuń:

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

Dodaj:

[adView setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; 
+0

się to nie faktycznie rozwiązać ten problem. Jeśli usuniesz te linie kodu i dodasz NIC, twój kod będzie działał równie dobrze. To NIE jest faktycznym zamiennikiem 'requiredContentSizeIdentifiers', gdybyś miał ustawiony krajobraz, a nie portret i próbował zastąpić kod powyższym kodem, zobaczyłbyś, że twoja aplikacja zaczyna się zrywać. –

0

iOS 6 jest wyposażony w wiele nowych aktualizacjach. Istnieje tak wiele elementów sterujących autorezwazją, które są przestarzałe. ADBannerContentSizeIdentifierPortrait jest również przestarzałe.

Oto link, który pomoże ci rozwiązać ten problem.

autolayout example

Powiązane problemy