2013-08-05 2 views
2

Я только недавно прочитал, что полноэкранный iAd работает только на iPad. ADInterstitialAd Этот класс для использования в разработке полноэкранного iAd. Как реализовать делегат-методы в ADInterstitialAdDelegate?Как показать полный экран iad для ipad

+1

http://www.raywenderlich.com/1371/iad-tutorial-for-ios-how-to-integrate-iad-into-your-iphone-app – IronManGill

ответ

0

Вы можете использовать это для создания Полноэкран ОВР

в файле .h

Импорт

#import <iAd/iAd.h> 

@interface ViewController : UIViewController<ADInterstitialAdDelegate> 
{ 
    ADInterstitialAd *interstitial; 
} 

в. М файл

@interface ViewController() 

// Interstitials 
- (void)cycleInterstitial; 

@implementation ViewController 

- (void)cycleInterstitial 
{ 
    // Clean up the old interstitial... 
    interstitial.delegate = nil; 
    // and create a new interstitial. We set the delegate so that we can be notified of when 
    interstitial = [[ADInterstitialAd alloc] init]; 
    interstitial.delegate = self; 
} 


#pragma mark ADInterstitialViewDelegate methods 

// When this method is invoked, the application should remove the view from the screen and tear it down. 
// The content will be unloaded shortly after this method is called and no new content will be loaded in that view. 
// This may occur either when the user dismisses the interstitial view via the dismiss button or 
// if the content in the view has expired. 
- (void)interstitialAdDidUnload:(ADInterstitialAd *)interstitialAd 
{ 
    [self cycleInterstitial]; 
} 

// This method will be invoked when an error has occurred attempting to get advertisement content. 
// The ADError enum lists the possible error codes. 
- (void)interstitialAd:(ADInterstitialAd *)interstitialAd didFailWithError:(NSError *)error 
{ 
    [self cycleInterstitial]; 
} 

// if you want to show iAd while pushing view controller just use 
- (IBAction)onSearchClick:(id)sender { 
    if (interstitial.loaded) { 
     //  [interstitial presentFromViewController:self]; // deprecated in iOS 6. 
     [self requestInterstitialAdPresentation]; // it will load iAD Full screen mode. 
    } 
// do whatever you want to do. 
} 

У счастливого кодирования. Приветствия.

+0

Это был пример, приведенный на developer.apple.com. , Так что это заслуживает доверия. –

Смежные вопросы