Float Ad - Atmosplay/AtmosplayAds-iOS GitHub Wiki

Initialization and request float ad

You should use the testing id in test phase. Testing id won't generate revenue. Please use official id when you release your App.

  #import <AtmosplayAds/AtmosplayFloatAd.h>
  @interface AtmosplayFloatAdViewController () <AtmosplayFloatAdDelegate>
  @property (nonatomic) AtmosplayFloatAd *floatAd;
  @end

  @implementation AtmosplayFloatAdViewController
  // init and load
  // AppID:your app id
  // adUnitID:your ad unit id
  // autoLoad: auto request next ad when you set YES
  self.floatAd = [[AtmosplayFloatAd alloc] initAndLoadAdWithAppID:@"Your_App_ID"
                                                         adUnitID:@"Your_AdUniit_ID"
                                                         autoLoad:YES];
  self.floatAd.delegate = self;
  @end

Show float ad

This method add the float ad to your screen.

warning:

  1. if you want to update the position, call the resetFloatAdFrameWith:width:rootViewController: please.
  2. if you want to show again after hiding, call the showAgainAfterHiding please.
  // show float ad
  // point:position of the float ad
  // width:width of the float ad
  // rootViewController:the vc will show the float ad

  float x = 10.0;
  float y = 10.0;
  float width = 150;
  if (self.floatAd.isReady) {
    [self.floatAd showFloatAdWith:CGPointMake(x,y) width:width rootViewController:self];
  }

Update float ad position

  // update float ad position
  // point:position of the float ad
  // width:width of the float ad
  // rootViewController:the vc will show the float ad

  float x = [self.xTextField.text floatValue];
  float y = [self.yTextField.text floatValue];
  float width = [self.widthTextField.text floatValue];
    
  [self.floatAd resetFloatAdFrameWith:CGPointMake(x, y) width:width rootViewController:self];

other method

// Make the floatAd's hidden value to Yes.
// Then the user can't see the ad in screen.
  - (void)hiddenFloatAd;
// Make the floatAd's hidden value to No.
// Then the user will see the ad again.
  - (void)showAgainAfterHiding;
  
  - (void)destroyFloatAd;

Implementing float ad events

/// Tells the delegate that an ad has been successfully loaded.
- (void)atmosplayFloatAdDidLoad:(AtmosplayFloatAd *)floatAd {
    [self addLog:@"atmosplayFloatAdDidLoad"];
}
/// Tells the delegate that a request failed.
- (void)atmosplayFloatAd:(AtmosplayFloatAd *)floatAd DidFailWithError:(NSError *)error {
    NSString *errorString = [[NSString alloc] initWithFormat:@"DidFailWithError %@",error.description];
    [self addLog:errorString];
}
/// Tells the delegate that the user should be rewarded.
- (void)atmosplayFloatAdDidRewardUser:(AtmosplayFloatAd *)floatAd {
    [self addLog:@"atmosplayFloatAdDidRewardUser"];
}
/// Tells the delegate that user starts playing the ad.
- (void)atmosplayFloatAdDidStartPlaying:(AtmosplayFloatAd *)floatAd {
    [self addLog:@"atmosplayFloatAdDidStartPlaying"];
}
/// Tells the delegate that the ad is being fully played.
- (void)atmosplayFloatAdDidEndPlaying:(AtmosplayFloatAd *)floatAd {
    [self addLog:@"atmosplayFloatAdDidEndPlaying"];
}
/// Tells the delegate that the landing page did present on the screen.
- (void)atmosplayFloatAdDidPresentLandingPage:(AtmosplayFloatAd *)floatAd {
    [self addLog:@"atmosplayFloatAdDidPresentLandingPage"];
}
/// Tells the delegate that the ad did animate off the screen.
- (void)atmosplayFloatAdDidDismissScreen:(AtmosplayFloatAd *)floatAd {
    [self addLog:@"atmosplayFloatAdDidDismissScreen"];
}
/// Tells the delegate that the ad is clicked
- (void)atmosplayFloatAdDidClick:(AtmosplayFloatAd *)floatAd {
    [self addLog:@"atmosplayFloatAdDidClick"];
}
⚠️ **GitHub.com Fallback** ⚠️