Window Ad - Atmosplay/AtmosplayAds-iOS Wiki

Initialization and request window ad

#import <AtmosplayAds/AtmosplayWindowAd.h>
@interface AtmosplayWindowAdViewController () <AtmosplayWindowAdDelegate>
@property (nonatomic) AtmosplayWindowAd *windowAd;
@end

// Initialization and request window ad
// AppID: your app id
// AdUnitID: your ad unit id
self.windowAd = [[AtmosplayWindowAd alloc] initAndLoadAdWithAppID:@"Your_App_ID" 
                                                         adUnitID:@"Your_AdUnit_ID"];
self.windowAd.delegate = self;

Show window ad

Call this method to place the window ad on the screen. It will auto load the next ad.

// show window ad
// point:position of the window ad
// width:width of the window ad
// transformAngle: transform angle of the window ad
// rootViewController:the vc will show the window ad
float x = 20.0;
float y = 100.0;
float angel = 5;
float width = 150;
    
if (self.windowAd.isReady) {
  [self.windowAd showWindowAdWith:CGPointMake(x, y)
                            width:width
                   transformAngle:angel
               rootViewController:self];
}

Close window ad

[self.windowAd closeWindowAd];

Implementing window ad events

#pragma mark - window ad delegate
/// Tells the delegate that an ad has been successfully loaded.
- (void)atmosplayWindowAdDidLoad:(AtmosplayWindowAd *)windowAd {
    [self addLog:@"atmosplayWindowAdDidLoad"];
}
/// Tells the delegate that a request failed.
- (void)atmosplayWindowAd:(AtmosplayWindowAd *)windowAd DidFailWithError:(NSError *)error {
    NSString *errorStr = [[NSString alloc] initWithFormat:@"DidFailWithError,%@",error.description];
    [self addLog:errorStr];
}
/// Tells the delegate that user starts playing the ad.
- (void)atmosplayWindowAdDidStartPlaying:(AtmosplayWindowAd *)windowAd {
    [self addLog:@"atmosplayWindowAdDidStartPlaying"];
}
/// Tells the delegate that the ad is being fully played.
- (void)atmosplayWindowAdDidEndPlaying:(AtmosplayWindowAd *)windowAd {
    [self addLog:@"atmosplayWindowAdDidEndPlaying"];
}
/// Tells the delegate that the ad is failed to play.
- (void)atmosplayWindowAdDidFailToPlay:(AtmosplayWindowAd *)windowAd {
    [self addLog:@"atmosplayWindowAdDidFailToPlay"];
}
/// Tells the delegate that the ad did animate off the screen.
- (void)atmosplayWindowAdDidDismissScreen:(AtmosplayWindowAd *)windowAd {
    [self addLog:@"atmosplayWindowAdDidDismissScreen"];
}
/// Tells the delegate that the ad is clicked
- (void)atmosplayWindowAdDidClick:(AtmosplayWindowAd *)windowAd {
    [self addLog:@"atmosplayWindowAdDidClick"];
}
⚠️ **GitHub.com Fallback** ⚠️