โฆษณาแบนเนอร์

โฆษณาแบนเนอร์คือโฆษณารูปสี่เหลี่ยมผืนผ้าที่ยึดพื้นที่ส่วนใดส่วนหนึ่งของเลย์เอาต์ของแอป โฆษณาเหล่านี้จะยังคงแสดงบนหน้าจอโดยอาจตรึงอยู่ที่ด้านบนหรือด้านล่างของหน้าจอ หรือแทรกอยู่ในเนื้อหาขณะที่ผู้ใช้เลื่อนดู แบนเนอร์ โฆษณาจะรีเฟรชโดยอัตโนมัติหลังจากเวลาผ่านไปช่วงหนึ่ง ดูภาพรวมของโฆษณาแบนเนอร์ เพื่อดูข้อมูลเพิ่มเติม

คู่มือนี้จะแสดงวิธีเริ่มต้นใช้งานโฆษณา Anchor โฆษณาแบนเนอร์แบบปรับขนาดได้ ซึ่งเพิ่มประสิทธิภาพสูงสุด โดยขนาดโฆษณาสำหรับอุปกรณ์แต่ละประเภท ความกว้างของโฆษณาที่คุณระบุ

แบนเนอร์แบบปรับขนาดได้แบบ Anchor

โฆษณาแบนเนอร์แบบปรับขนาดได้แบบโฆษณา Anchor คือโฆษณาที่มีสัดส่วนภาพคงที่ ไม่ใช่โฆษณาปกติ โฆษณาที่มีขนาดคงที่ สัดส่วนภาพใกล้เคียงกับมาตรฐานอุตสาหกรรม 320x50 ครั้งเดียว ระบุความกว้างเต็ม ระบบจะแสดงโฆษณาที่มีความสูงที่เหมาะสมที่สุดสำหรับ ความกว้างนั้น ความสูงที่เหมาะสมจะไม่เปลี่ยนแปลงเมื่อมีคำขอเดียวกัน และมุมมองโดยรอบจะไม่ต้องเคลื่อนที่เมื่อโฆษณารีเฟรช

ข้อกำหนดเบื้องต้น

ทดสอบด้วยโฆษณาทดสอบเสมอ

เมื่อสร้างและทดสอบแอป โปรดใช้โฆษณาทดสอบแทน โฆษณาที่ใช้งานจริง หากไม่ดำเนินการ บัญชีจะถูกระงับ

วิธีที่ง่ายที่สุดในการโหลดโฆษณาทดสอบคือการใช้รหัสหน่วยโฆษณาทดสอบสำหรับ iOS โดยเฉพาะ แบนเนอร์:

/21775744923/example/adaptive-banner

โดยได้รับการกำหนดค่าเป็นพิเศษให้ส่งคืนโฆษณาทดสอบสำหรับทุกคำขอ โดยคุณจะ นำไปใช้ในแอปของคุณเองขณะเขียนโค้ด ทดสอบ และแก้ไขข้อบกพร่องได้ฟรี ทำ อย่าลืมแทนที่ด้วยรหัสหน่วยโฆษณาของคุณเองก่อนที่จะเผยแพร่แอป

สำหรับข้อมูลเพิ่มเติมเกี่ยวกับวิธีการทำงานของโฆษณาทดสอบ SDK โฆษณาบนอุปกรณ์เคลื่อนที่ โปรดดูการทดสอบ โฆษณา

สร้าง GAMแบนเนอร์View

โฆษณาแบนเนอร์จะแสดงใน GAMBannerView ดังนั้น ขั้นตอนแรกในการผสานรวมโฆษณาแบนเนอร์คือการเพิ่ม GAMBannerView ในลำดับชั้นการแสดงผลของคุณ ซึ่งโดยปกติจะดำเนินการแบบเป็นโปรแกรมหรือ ผ่านทาง Interface Builder

แบบเป็นโปรแกรม

นอกจากนี้ คุณยังสร้างอินสแตนซ์ GAMBannerView โดยตรงได้ด้วย ตัวอย่างต่อไปนี้สร้าง GAMBannerView

Swift

import GoogleMobileAds
import UIKit

class ViewController: UIViewController {

  var bannerView: GAMBannerView!

  override func viewDidLoad() {
    super.viewDidLoad()

    let viewWidth = view.frame.inset(by: view.safeAreaInsets).width

    // Here the current interface orientation is used. Use
    // GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth or
    // GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth if you prefer to load an ad of a
    // particular orientation,
    let adaptiveSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(viewWidth)
    bannerView = GAMBannerView(adSize: adaptiveSize)

    addBannerViewToView(bannerView)
  }

  func addBannerViewToView(_ bannerView: GAMBannerView) {
    bannerView.translatesAutoresizingMaskIntoConstraints = false
    view.addSubview(bannerView)
    // This example doesn't give width or height constraints, as the provided
    // ad size gives the banner an intrinsic content size to size the view.
    view.addConstraints(
      [NSLayoutConstraint(item: bannerView,
                          attribute: .bottom,
                          relatedBy: .equal,
                          toItem: view.safeAreaLayoutGuide,
                          attribute: .bottom,
                          multiplier: 1,
                          constant: 0),
      NSLayoutConstraint(item: bannerView,
                          attribute: .centerX,
                          relatedBy: .equal,
                          toItem: view,
                          attribute: .centerX,
                          multiplier: 1,
                          constant: 0)
      ])
  }
}

SwiftUI

หากต้องการใช้ GAMBannerView ให้สร้าง UIViewRepresentable โดยทำดังนี้

private struct BannerView: UIViewRepresentable {
  let adSize: GADAdSize

  init(_ adSize: GADAdSize) {
    self.adSize = adSize
  }

  func makeUIView(context: Context) -> UIView {
    // Wrap the GADBannerView in a UIView. GADBannerView automatically reloads a new ad when its
    // frame size changes; wrapping in a UIView container insulates the GADBannerView from size
    // changes that impact the view returned from makeUIView.
    let view = UIView()
    view.addSubview(context.coordinator.bannerView)
    return view
  }

  func updateUIView(_ uiView: UIView, context: Context) {
    context.coordinator.bannerView.adSize = adSize
  }

  func makeCoordinator() -> BannerCoordinator {
    return BannerCoordinator(self)
  }

หากต้องการจัดการการเริ่มต้นและลักษณะการทํางานของ GAMBannerView ให้สร้าง Coordinator ดังนี้

class BannerCoordinator: NSObject, GADBannerViewDelegate {

  private(set) lazy var bannerView: GADBannerView = {
    let banner = GADBannerView(adSize: parent.adSize)
    banner.adUnitID = "ca-app-pub-3940256099942544/2435281174"
    banner.load(GADRequest())
    banner.delegate = self
    return banner
  }()

  let parent: BannerView

  init(_ parent: BannerView) {
    self.parent = parent
  }

หากต้องการดูความกว้างของมุมมอง ให้ใช้ GeometryReader ชั้นเรียนนี้ คำนวณขนาดโฆษณาที่เหมาะสมสำหรับการวางแนวอุปกรณ์ในปัจจุบัน frame ได้รับการตั้งค่าเป็นความสูงที่คำนวณจากขนาดโฆษณา

var body: some View {
  GeometryReader { geometry in
    let adSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(geometry.size.width)

    VStack {
      Spacer()
      BannerView(adSize)
        .frame(height: adSize.size.height)
    }
  }

Objective-C

โปรดทราบว่าในกรณีนี้เราไม่ได้จำกัดความกว้างหรือความสูง เนื่องจาก ขนาดโฆษณาที่ระบุจะทำให้แบนเนอร์มีขนาดเนื้อหาที่แท้จริง

@import GoogleMobileAds;

@interface ViewController ()

@property(nonatomic, strong) GAMBannerView *bannerView;

@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];

  // Here safe area is taken into account, hence the view frame is used after the
  // view has been laid out.
  CGRect frame = UIEdgeInsetsInsetRect(self.view.frame, self.view.safeAreaInsets);
  CGFloat viewWidth = frame.size.width;

  // Here the current interface orientation is used. If the ad is being preloaded
  // for a future orientation change or different orientation, the function for the
  // relevant orientation should be used.
  GADAdSize adaptiveSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(viewWidth);
  // In this case, we instantiate the banner with desired ad size.
  self.bannerView = [[GAMBannerView alloc] initWithAdSize:adaptiveSize];

  [self addBannerViewToView:self.bannerView];
}

- (void)addBannerViewToView:(UIView *)bannerView {
  bannerView.translatesAutoresizingMaskIntoConstraints = NO;
  [self.view addSubview:bannerView];
  // This example doesn't give width or height constraints, as the provided
  // ad size gives the banner an intrinsic content size to size the view.
  [self.view addConstraints:@[
    [NSLayoutConstraint constraintWithItem:bannerView
                              attribute:NSLayoutAttributeBottom
                              relatedBy:NSLayoutRelationEqual
                                  toItem:self.view.safeAreaLayoutGuide
                              attribute:NSLayoutAttributeBottom
                              multiplier:1
                                constant:0],
    [NSLayoutConstraint constraintWithItem:bannerView
                              attribute:NSLayoutAttributeCenterX
                              relatedBy:NSLayoutRelationEqual
                                  toItem:self.view
                              attribute:NSLayoutAttributeCenterX
                              multiplier:1
                                constant:0]
                                ]];
}
@end

เครื่องมือสร้างอินเทอร์เฟซ

คุณสามารถเพิ่ม GAMBannerView ลงในสตอรี่บอร์ดหรือไฟล์ xib ได้ เมื่อใช้สิ่งนี้ ให้เพิ่มข้อจำกัดตำแหน่งบนแบนเนอร์เท่านั้น ตัวอย่างเช่น เมื่อแสดงแบนเนอร์แบบปรับขนาดได้ที่ด้านล่างของหน้าจอ ให้ตั้งค่าด้านล่าง ของมุมมองแบนเนอร์ที่เท่ากับด้านบนของคู่มือการออกแบบด้านล่าง และตั้งค่า centerX เท่ากับ centerX ของซูเปอร์วิว

ระบบจะยังคงกำหนดขนาดโฆษณาของแบนเนอร์แบบเป็นโปรแกรม ดังนี้

Swift

bannerView.adSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(viewWidth)

Objective-C

self.bannerView.adSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(viewWidth);

โหลดโฆษณา

เมื่อเริ่มใช้งาน GAMBannerView และพร็อพเพอร์ตี้แล้ว คุณก็ได้เวลาโหลดโฆษณาแล้ว ซึ่งทำได้โดยโทรไปที่ loadRequest: บน GAMRequest ออบเจ็กต์:

Swift

override func viewDidLoad() {
  super.viewDidLoad()
  // Set the ad unit ID and view controller that contains the GAMBannerView.
  bannerView.adUnitID = "/21775744923/example/adaptive-banner"
  bannerView.rootViewController = self

  bannerView.load(GAMRequest())
}

SwiftUI

banner.adUnitID = "ca-app-pub-3940256099942544/2435281174"
banner.load(GADRequest())

Objective-C

- (void)viewDidLoad {
  [super viewDidLoad];
  // Set the ad unit ID and view controller that contains the GAMBannerView.
  self.bannerView.adUnitID = @"/21775744923/example/adaptive-banner";
  self.bannerView.rootViewController = self;

  [self.bannerView loadRequest:[GAMRequest request]];
}

ออบเจ็กต์ GAMRequest แสดงถึงคําขอโฆษณารายการเดียว และมีพร็อพเพอร์ตี้สําหรับข้อมูลต่างๆ เช่น ข้อมูลการกําหนดเป้าหมาย

หากโฆษณาโหลดไม่สําเร็จ คุณไม่จําเป็นต้องขอโฆษณาอื่นอย่างชัดเจน ตราบใดที่คุณกําหนดค่าหน่วยโฆษณาให้รีเฟรช Google Mobile Ads SDK จะเป็นไปตามอัตราการรีเฟรชที่คุณระบุไว้ใน UI ของ Ad Manager หากไม่ได้เปิดใช้การรีเฟรช คุณจะต้องส่งคำขอใหม่

เหตุการณ์โฆษณา

เมื่อใช้ GADBannerViewDelegate คุณจะสามารถฟังเหตุการณ์ในวงจรได้ เช่น เมื่อปิดโฆษณา หรือเมื่อผู้ใช้ออกจากแอป

ลงทะเบียนเข้าร่วมกิจกรรมแบนเนอร์

หากต้องการลงทะเบียนเหตุการณ์โฆษณาแบนเนอร์ ให้ตั้งค่าพร็อพเพอร์ตี้ delegate ใน GAMBannerView เป็นออบเจ็กต์ที่ใช้โปรโตคอล GADBannerViewDelegate โดยทั่วไป ชั้นเรียนที่ใช้แบนเนอร์ โฆษณายังทำหน้าที่เป็นคลาสผู้รับมอบสิทธิ์ ซึ่งในกรณีนี้พร็อพเพอร์ตี้ delegate สามารถ ตั้งค่าเป็น self

Swift

import GoogleMobileAds
import UIKit

class ViewController: UIViewController, GADBannerViewDelegate {

  var bannerView: GAMBannerView!

  override func viewDidLoad() {
    super.viewDidLoad()
    // ...
    bannerView.delegate = self
  }
}

SwiftUI

banner.delegate = self

Objective-C

@import GoogleMobileAds;

@interface ViewController () <GADBannerViewDelegate>

@property(nonatomic, strong) GAMBannerView *bannerView;

@end

@implementation ViewController

-   (void)viewDidLoad {
  [super viewDidLoad];
  // ...
  self.bannerView.delegate = self;
}

ใช้เหตุการณ์แบนเนอร์

แต่ละวิธีใน GADBannerViewDelegate จะมีการทำเครื่องหมายเป็นไม่บังคับ เพื่อให้คุณ แต่ให้ใช้วิธีการที่คุณต้องการเท่านั้น ตัวอย่างนี้ใช้แต่ละเมธอดและบันทึกข้อความไปยังคอนโซล

Swift

func bannerViewDidReceiveAd(_ bannerView: GADBannerView) {
  print("bannerViewDidReceiveAd")
}

func bannerView(_ bannerView: GADBannerView, didFailToReceiveAdWithError error: Error) {
  print("bannerView:didFailToReceiveAdWithError: \(error.localizedDescription)")
}

func bannerViewDidRecordImpression(_ bannerView: GADBannerView) {
  print("bannerViewDidRecordImpression")
}

func bannerViewWillPresentScreen(_ bannerView: GADBannerView) {
  print("bannerViewWillPresentScreen")
}

func bannerViewWillDismissScreen(_ bannerView: GADBannerView) {
  print("bannerViewWillDIsmissScreen")
}

func bannerViewDidDismissScreen(_ bannerView: GADBannerView) {
  print("bannerViewDidDismissScreen")
}

Objective-C

- (void)bannerViewDidReceiveAd:(GADBannerView *)bannerView {
  NSLog(@"bannerViewDidReceiveAd");
}

- (void)bannerView:(GADBannerView *)bannerView didFailToReceiveAdWithError:(NSError *)error {
  NSLog(@"bannerView:didFailToReceiveAdWithError: %@", [error localizedDescription]);
}

- (void)bannerViewDidRecordImpression:(GADBannerView *)bannerView {
  NSLog(@"bannerViewDidRecordImpression");
}

- (void)bannerViewWillPresentScreen:(GADBannerView *)bannerView {
  NSLog(@"bannerViewWillPresentScreen");
}

- (void)bannerViewWillDismissScreen:(GADBannerView *)bannerView {
  NSLog(@"bannerViewWillDismissScreen");
}

- (void)bannerViewDidDismissScreen:(GADBannerView *)bannerView {
  NSLog(@"bannerViewDidDismissScreen");
}

ดูตัวอย่างผู้รับมอบสิทธิ์โฆษณาสําหรับการใช้งานเมธอดผู้รับมอบสิทธิ์แบนเนอร์ในแอปสาธิต iOS API

Swift Objective-C

กรณีการใช้งาน

ต่อไปนี้เป็นตัวอย่างกรณีการใช้งานสำหรับวิธีเหตุการณ์โฆษณาเหล่านี้

เพิ่มแบนเนอร์ในลำดับชั้นการดูเมื่อได้รับโฆษณา

คุณอาจต้องเลื่อนการเพิ่ม GAMBannerView ไปยัง ลำดับชั้นการดูจนกระทั่งหลังจากได้รับโฆษณา ซึ่งทำได้โดยฟังเหตุการณ์ bannerViewDidReceiveAd: ดังนี้

Swift

func bannerViewDidReceiveAd(_ bannerView: GADBannerView) {
  // Add banner to view and add constraints.
  addBannerViewToView(bannerView)
}

Objective-C

- (void)bannerViewDidReceiveAd:(GAMBannerView *)bannerView {
  // Add bannerView to view and add constraints as above.
  [self addBannerViewToView:self.bannerView];
}

สร้างภาพเคลื่อนไหวของโฆษณาแบนเนอร์

คุณยังใช้เหตุการณ์ bannerViewDidReceiveAd: เพื่อให้โฆษณาแบนเนอร์เคลื่อนไหวครั้งเดียวได้ด้วย จะส่งคืนกลับมา ดังที่แสดงในตัวอย่างต่อไปนี้

Swift

func bannerViewDidReceiveAd(_ bannerView: GADBannerView) {
  bannerView.alpha = 0
  UIView.animate(withDuration: 1, animations: {
    bannerView.alpha = 1
  })
}

Objective-C

- (void)bannerViewDidReceiveAd:(GAMBannerView *)bannerView {
  bannerView.alpha = 0;
  [UIView animateWithDuration:1.0 animations:^{
    bannerView.alpha = 1;
  }];
}

หยุดแอปชั่วคราวและเล่นต่อ

โปรโตคอล GADBannerViewDelegate มีวิธีการแจ้งเตือนคุณเกี่ยวกับเหตุการณ์ต่างๆ เช่น เมื่อการคลิกทําให้ระบบแสดงหรือปิดการวางซ้อน หากคุณต้องการ ติดตามว่าเหตุการณ์เหล่านี้เกิดจากโฆษณาหรือไม่ ให้ลงทะเบียน GADBannerViewDelegate วิธี

หากต้องการตรวจจับงานนำเสนอซ้อนทับหรือการเรียกใช้เบราว์เซอร์ภายนอกทุกประเภท ไม่ใช่ เฉพาะคลิกที่มาจากการคลิกโฆษณา แอปของคุณจะน่าฟังมากกว่า เมธอดที่เทียบเท่าใน UIViewController หรือ UIApplication ตารางต่อไปนี้แสดงเมธอด iOS ที่เทียบเท่าซึ่งเรียกใช้พร้อมกันกับเมธอด GADBannerViewDelegate

เมธอด GADBannerViewDelegate วิธีการสำหรับ iOS
bannerViewWillPresentScreen: viewWillDisappear:ของ UIViewController
bannerViewWillDismissScreen: viewWillAppear:ของ UIViewController
bannerViewDidDismissScreen: viewDidAppear:ของ UIViewController

การนับการแสดงผลด้วยตนเอง

คุณสามารถส่งคำสั่ง ping ของการแสดงผลไปยัง Ad Manager ด้วยตนเองได้หากมีกรณีพิเศษ เงื่อนไขว่าควรบันทึกการแสดงผลเมื่อใด ซึ่งสามารถดำเนินการได้โดยเริ่มจาก เปิดใช้ GAMBannerView สำหรับการแสดงผลด้วยตนเองก่อนโหลดโฆษณา

Swift

bannerView.enableManualImpressions = true

Objective-C

self.bannerView.enableManualImpressions = YES;

เมื่อคุณพิจารณาว่าโฆษณาแสดงสำเร็จแล้ว และแสดงอยู่บนหน้าจอ คุณสามารถเริ่มการแสดงผลด้วยตนเองได้โดยทำดังนี้

Swift

bannerView.recordImpression()

Objective-C

[self.bannerView recordImpression];

เหตุการณ์ของแอป

เหตุการณ์ของแอปทำให้คุณสามารถสร้างโฆษณาที่จะส่งข้อความไปยังโค้ดของแอปได้ สามารถดำเนินการโดยอิงจากข้อความเหล่านี้ได้

คุณเฝ้าติดตามเหตุการณ์ในแอปเฉพาะของ Ad Manager ได้โดยใช้ GADAppEventDelegate เหตุการณ์เหล่านี้อาจเกิดขึ้นได้ตลอดเวลาในระหว่างวงจรของโฆษณา แม้กระทั่งก่อน มีการเรียก bannerViewDidReceiveAd: ของวัตถุ GADBannerViewDelegate

Swift

// Implement your app event within this method. The delegate will be
// notified when the SDK receives an app event message from the ad.

// Called when the banner receives an app event.
optional public func bannerView(_ banner: GAMBannerView,
    didReceiveAppEvent name: String, withInfo info: String?)

Objective-C

// Implement your app event within this method. The delegate will be
// notified when the SDK receives an app event message from the ad.

@optional
// Called when the banner receives an app event.
-   (void)bannerView:(GAMBannerView *)banner
    didReceiveAppEvent:(NSString *)name
              withInfo:(NSString *)info;

คุณใช้เมธอดเหตุการณ์ของแอปในตัวควบคุมการดูได้โดยทำดังนี้

Swift

import GoogleMobileAds

class ViewController: UIViewController, GADAppEventDelegate {}

Objective-C

@import GoogleMobileAds;

@interface ViewController : UIViewController <GADAppEventDelegate> {}

@end

อย่าลืมกำหนดผู้รับมอบสิทธิ์โดยใช้พร็อพเพอร์ตี้ appEventDelegate ก่อนดำเนินการ คำขอโฆษณา

Swift

bannerView.appEventDelegate = self

Objective-C

self.bannerView.appEventDelegate = self;

นี่เป็นตัวอย่างที่แสดงวิธีเปลี่ยนสีพื้นหลังของแอปโดย ระบุสีผ่านเหตุการณ์ของแอป

Swift

func bannerView(_ banner: GAMBannerView, didReceiveAppEvent name: String,
    withInfo info: String?) {
  if name == "color" {
    guard let info = info else { return }
    switch info {
    case "green":
      // Set background color to green.
      view.backgroundColor = UIColor.green
    case "blue":
      // Set background color to blue.
      view.backgroundColor = UIColor.blue
    default:
      // Set background color to black.
      view.backgroundColor = UIColor.black
    }
  }
}

Objective-C

- (void)bannerView:(GAMBannerView *)banner
    didReceiveAppEvent:(NSString *)name
              withInfo:(NSString *)info {
  if ([name isEqual:@"color"]) {
    if ([info isEqual:@"green"]) {
      // Set background color to green.
      self.view.backgroundColor = [UIColor greenColor];
    } else if ([info isEqual:@"blue"]) {
      // Set background color to blue.
      self.view.backgroundColor = [UIColor blueColor];
    } else {
      // Set background color to black.
      self.view.backgroundColor = [UIColor blackColor];
    }
  }
}

และนี่คือครีเอทีฟโฆษณาที่เกี่ยวข้องซึ่งส่งข้อความเหตุการณ์ของแอปสีไปยัง appEventDelegate:

<html>
<head>
  <script src="//www.gstatic.com/afma/api/v1/google_mobile_app_ads.js"></script>
  <script>
    document.addEventListener("DOMContentLoaded", function() {
      // Send a color=green event when ad loads.
      admob.events.dispatchAppEvent("color", "green");

      document.getElementById("ad").addEventListener("click", function() {
        // Send a color=blue event when ad is clicked.
        admob.events.dispatchAppEvent("color", "blue");
      });
    });
  </script>
  <style>
    #ad {
      width: 320px;
      height: 50px;
      top: 0px;
      left: 0px;
      font-size: 24pt;
      font-weight: bold;
      position: absolute;
      background: black;
      color: white;
      text-align: center;
    }
  </style>
</head>
<body>
  <div id="ad">Carpe diem!</div>
</body>
</html>

ดูตัวอย่างเหตุการณ์แอปของ Ad Manager สำหรับการติดตั้งใช้งานเหตุการณ์ของแอปใน แอปเดโม iOS API

Swift Objective-C

แหล่งข้อมูลเพิ่มเติม

ตัวอย่างใน GitHub

  • ตัวอย่างโฆษณาแบนเนอร์แบบปรับขนาดได้แบบโฆษณา Anchor Swift | SwiftUI | Objective-C
  • การสาธิตฟีเจอร์ขั้นสูง: Swift | Objective-C

ขั้นตอนถัดไป

แบนเนอร์แบบย่อได้

โฆษณาแบนเนอร์แบบยุบได้คือโฆษณาแบนเนอร์ที่แสดงเป็นโฆษณาซ้อนทับขนาดใหญ่ในตอนแรก โดยมีปุ่มสำหรับยุบโฆษณาให้มีขนาดเล็กลง ลองใช้ เพื่อเพิ่มประสิทธิภาพให้ดียิ่งขึ้นไปอีก ดูรายละเอียดเพิ่มเติมได้ที่โฆษณาแบนเนอร์แบบย่อได้

แบนเนอร์แทรกในบรรทัดที่ปรับเปลี่ยนได้

แบนเนอร์แทรกในบรรทัดที่ปรับเปลี่ยนได้คือแบนเนอร์ที่มีขนาดใหญ่และสูงกว่าเมื่อเทียบกับแบนเนอร์ยึดตำแหน่งที่ปรับเปลี่ยนได้ แบนเนอร์ มีความสูงที่ไม่คงที่และสูงเท่ากับหน้าจอของอุปกรณ์ได้ เราขอแนะนําให้ใช้แบนเนอร์แบบปรับขนาดได้ที่แทรกในบรรทัดแทนโฆษณาแบนเนอร์แบบปรับขนาดได้ที่ยึดตําแหน่งไว้สําหรับแอปที่แสดงโฆษณาแบนเนอร์ในเนื้อหาที่เลื่อนได้ ดูรายละเอียดเพิ่มเติมได้ที่แบนเนอร์แบบปรับเปลี่ยนในบรรทัด

สำรวจหัวข้ออื่นๆ