Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageobjective-c
@interface ViewController ()

@property (nonatomic, strong, readonly) BZVNativeAdViewBinder *viewBinder;

@end

@implementation ViewController

- (void)viewDidLoad {
  ...생략...

 
BZVNativeAdRequest *adRequest =
[[BZVNativeAdRequest alloc] init];
  BZVBuzzAdNative *buzzAdNative  _viewBinder = [BZVBuzzAdNative nativeWithUnitId:@"YOUR_NATIVE_UNIT_ID"];
  [buzzAdNative loadAdWithAdRequest:adRequest onSuccessBZVNativeAdViewBinder viewBinderWithBlock:^(BZVNativeAdBZVNativeAdViewBinderBuilder * _Nonnull nativeAdbuilder) {
    // 할당된 광고가 있으면 호출됩니다.
builder.nativeAdView = self.nativeAdView;
    builder.mediaView = self.mediaView;
   // 광고builder.iconImageView 데이터를= 바인딩합니다self.iconImageView;
    builder.titleLabel [self renderAd:nativeAd]= self.titleLabel;
  } onFailure:^(BZVError * _Nonnull error) { builder.descriptionLabel = self.descriptionLabel;
    builder.ctaView // 할당된 광고가 없으면 호출됩니다.= self.ctaView;
  }];

   NSLog(@"Failed to load a native ad");
  }BZVNativeAdRequest *adRequest = [[BZVNativeAdRequest alloc] init];
}  - (void)renderAd:(BZVNativeAd *)ad {
  BZVNativeAdViewBinder *viewBinder = [BZVNativeAdViewBinder viewBinderWithBlock:^(BZVNativeAdViewBinderBuilderBZVBuzzAdNative *buzzAdNative = [BZVBuzzAdNative nativeWithUnitId:@"YOUR_NATIVE_UNIT_ID"];
  [buzzAdNative loadAdWithAdRequest:adRequest onSuccess:^(BZVNativeAd * _Nonnull buildernativeAd) {
    builder.nativeAdView = self.nativeAdView;
    builder.mediaView = self.mediaView// 할당된 광고가 있으면 호출됩니다.
    // 광고 데이터를 바인딩합니다.
    [self renderAd:nativeAd];
  }  builder.iconImageView = self.iconImageView;
 onFailure:^(BZVError * _Nonnull error) {
  builder.titleLabel = self.titleLabel;
    builder.descriptionLabel = self.descriptionLabel;
    builder.ctaView = self.ctaView // 할당된 광고가 없으면 호출됩니다.
    NSLog(@"Failed to load a native ad");
  }];
}

- (void)renderAd:(BZVNativeAd *)ad {
  [_viewBinder bindWithNativeAd:ad];
}

@end

...

Code Block
languageswift
final class ViewController: UIViewController {
  lazy overridevar func viewDidLoad() {
    ...생략...
    
viewBinder = BZVNativeAdViewBinder { builder in
   let nativeAdRequestbuilder.nativeAdView = BZVNativeAdRequest()self.nativeAdView
    letbuilder.mediaView buzzAdNative= = BZVBuzzAdNative(unitId: "YOUR_NATIVE_UNIT_ID")self.mediaView
    builder.iconImageView = buzzAdNative.loadAd(with: nativeAdRequest) { nativeAd in
  self.iconImageView
    builder.titleLabel = self.titleLabel
   // 할당된builder.descriptionLabel 광고가= 있으면 호출됩니다self.descriptionLabel
    builder.ctaView = //self.ctaView
광고 데이터를 바인딩합니다. }

  override func self.renderAdviewDidLoad(nativeAd) {
   } onFailure: { error in ...생략...
    
    //let 할당된nativeAdRequest 광고가= 없으면BZVNativeAdRequest()
호출됩니다.    let buzzAdNative = printBZVBuzzAdNative("Failed to load a native ad")
    }
  }

  func renderAd(_ ad: BZVNativeAd) {unitId: "YOUR_NATIVE_UNIT_ID")
    buzzAdNative.loadAd(with: nativeAdRequest) { nativeAd in
      // 할당된 광고가 있으면 호출됩니다.
     let viewBinder// =광고 BZVNativeAdViewBinder데이터를 {바인딩합니다.
builder in     self.renderAd(nativeAd)
 builder.nativeAdView = self.nativeAdView } onFailure: { error in
 builder.mediaView = self.mediaView   // 할당된 광고가 없으면 builder.iconImageView = self.iconImageView
      builder.titleLabel = self.titleLabel
      builder.ctaView = self.ctaView
    }
    호출됩니다.
      print("Failed to load a native ad")
    }
  }

  func renderAd(_ ad: BZVNativeAd) {
    viewBinder.bind(with: ad)
  }
}

...

Code Block
languageobjective-c
@import UIKit;
@import BuzzAdBenefit;

@interface CustomCtaView : UIView <BZVCtaViewProtocol>

@end

@implementation CustomCtaView

...생략...

#pragma mark - BZVCtaViewProtocol
- (void)renderRewardNotAvailableViewStateWithCtaText:(NSString *)ctaText {
  // 리워드가 없는 광고에 대한 CTA 뷰 레이아웃을 정의합니다.
}

- (void)renderRewardAvailableViewStateWithCtaText:(NSString *)ctaText reward:(NSInteger)reward {
  // 리워드가 있는 광고에 대한 CTA 뷰 레이아웃을 정의합니다.
}

- (void)renderParticipatingViewStateWithCtaText:(NSString *)ctaText {
  // 참여 확인 중인 광고에 대한 CTA 뷰 레이아웃을 정의합니다.
}

- (void)renderParticipatedViewStateWithCtaText:(NSString *)ctaText {
  // 참여 완료한 광고에 대한 CTA 뷰 레이아웃을 정의합니다.
}
Code Block
languageobjective-c
@import UIKit;
@import BuzzAdBenefit;

@interface ViewController ()

@property (nonatomic, strong, readonly) BZVNativeAdView *nativeAdView;
@property (nonatomic, strong, readonly) BZVMediaView *mediaView;
@property (nonatomic, strong, readonly) UIImageView *iconImageView;
@property (nonatomic, strong, readonly) UILabel *titleLabel;
@property (nonatomic, strong, readonly) UILabel *descriptionLabel;
@property (nonatomic, strong, readonly) CustomCtaView *ctaView;
@property (nonatomic, strong, readonly) BZVNativeAdViewBinder *viewBinder;

@end

@implementation ViewController

- (void)viewDidLoad {
  ...생략...

- (void)renderAd:(BZVNativeAd
*)ad { 
 BZVNativeAdViewBinder *_viewBinder = [BZVNativeAdViewBinder viewBinderWithBlock:^(BZVNativeAdViewBinderBuilder * _Nonnull builder) {
    builder.nativeAdView = self.nativeAdView;
    builder.mediaView = self.mediaView;
    builder.iconImageView = self.iconImageView;
    builder.titleLabel = self.titleLabel;
    builder.descriptionLabel = self.descriptionLabel;
    builder.ctaView = self.ctaView;
  }];
}

- (void)renderAd:(BZVNativeAd *)ad {
  [_viewBinder bindWithNativeAd:ad];
}

@end

...

Code Block
languageswift
import UIKit
import BuzzAdBenefit

final class CustomCtaView: UIView, BZVCtaViewProtocol {
  ...생략...

  // MARK: BZVCtaViewProtocol
  func renderRewardNotAvailableViewState(withCtaText ctaText: String) {
    // 리워드가 없는 광고에 대한 CTA 뷰 레이아웃을 정의합니다.
  }

  func renderRewardAvailableViewState(withCtaText ctaText: String, reward: Int) {
    // 리워드가 있는 광고에 대한 CTA 뷰 레이아웃을 정의합니다.
  }

  func renderParticipatingViewState(withCtaText ctaText: String) {
    // 참여 확인 중인 광고에 대한 CTA 뷰 레이아웃을 정의합니다.
  }

  func renderParticipatedViewState(withCtaText ctaText: String) {
    // 참여 완료한 광고에 대한 CTA 뷰 레이아웃을 정의합니다.
  }
}
Code Block
import UIKit
import BuzzAdBenefit

final class ViewController: UIViewController {
  let nativeAdView = BZVNativeAdView(frame: .zero)
  let mediaView = BZVMediaView(frame: .zero)
  let iconImageView = UIImageView(frame: .zero)
  let titleLabel = UILabel(frame: .zero)
  let descriptionLabel = UILabel(frame: .zero)
  let ctaView = CustomCtaView(frame: .zero)
   ...생략...
  
  override func renderAd(_ ad: BZVNativeAd) {
    letlazy var viewBinder = BZVNativeAdViewBinder { builder in

     builder.nativeAdView = self.nativeAdView
      builder.mediaView = self.mediaView
      builder.iconImageView = self.iconImageView
 
    builder.titleLabel = self.titleLabel
    builder.descriptionLabel = self.descriptionLabel
    builder.ctaView = self.ctaView
  }

  ...생략...
  
  override func renderAd(_ ad: BZVNativeAd) }{
    viewBinder.bind(with: ad)
  }
}

...