Auto Scaling Ad Sizes - fan-ADN/nendSDK-iOS GitHub Wiki

Regarding Auto Scaling Ad Sizes

Starting from SDK ver 2.6.0, banner sizes will be scaled automatically depending on the width of every smartphone device. By using auto scale, the ad will be scaled based on the width of the device.

Please refer to Regarding Ad Formats and Sizes for display examples

Implementation Procedure

Generating NADView

Please check the following method when generating NADView:

  • - (instancetype)initWithFrame:(CGRect)frame isAdjustAdSize:(BOOL)isAdjust
    Ad scale will be featured when setting true to isAdjustAdSize.

    Swift
    nadView = NADView(frame: CGRect(x: 0, y: 0, width: 320, height: 50), isAdjustAdSize: true)
    Objective-C
    self.nadView = [[NADView alloc] initWithFrame:CGRectZero isAdjustAdSize:YES];
  • - (instancetype)initWithIsAdjustAdSize:(BOOL)isAdjust
    Ad scale will be featured when setting true.

    Swift
    nadView = NADView(isAdjustAdSize: true)
    Objective-C
    self.nadView = [[NADView alloc] initWithIsAdjustAdSize:YES];

    ※Initial position is x:0, y:0. Please set the position after generating.

Regarding the configuration of NADView

Ad Scaling is done when the ad data is read and scaled in NADView.
It is recommended to to configure NADView after the loading is complete.

Swift
func nadViewDidFinishLoad(_ adView: NADView!) {
    // Use nadViewDidFinishLoad if you want to add View after the ad is loaded.
    // Displaying ad at the bottom of the screen
    self.nadView.frame = CGRect(x: (self.view.frame.size.width - self.nadView.frame.size.width) / 2,
                                y: self.view.frame.size.height - self.nadView.frame.size.height,
                                width: self.nadView.frame.size.width, height: self.nadView.frame.size.height)
    self.view.addSubview(self.nadView)
}
Objective-C
- (void)nadViewDidFinishLoad:(NADView *)adView
{
    // Use nadViewDidFinishLoad if you want to add View after the ad is loaded.
    // Displaying ad at the bottom of the screen
    [self.nadView setFrame:CGRectMake((self.view.frame.size.width - self.nadView.frame.size.width) / 2,
                                      self.view.frame.size.height - self.nadView.frame.size.height,
                                      self.nadView.frame.size.width, self.nadView.frame.size.height)];
    [self.view addSubview:self.nadView];
}
⚠️ **GitHub.com Fallback** ⚠️