> For the complete documentation index, see [llms.txt](https://adpopcornssp.gitbook.io/ssp-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://adpopcornssp.gitbook.io/ssp-sdk/sdk/ios/ios-2.x.x/layout/adpopcornssp-layout/undefined-1.md).

# 템플릿 사용

## 1. 스토리보드에 UI View 생성

스토리보드에 UIView 생성 후 Custom Class을 AdPopcornSSPNativeAd로 설정합니다.&#x20;

<mark style="color:red;">`AdPopcornSSPNativeAd`</mark> View 안에 사용하고자 하는 UI component를 아래 샘플과 같이 추가합니다.

<figure><img src="/files/iJkHCCto96uG5yhgA5Ik" alt=""><figcaption><p>AdPopcornSSPNativeAd View</p></figcaption></figure>

## 2. 실제 광고 영역 추가

AdPopcornSSPNativeAd 영역 안에 실제 광고 영역 추가합니다.

{% hint style="info" %}
AdPopcornSSP의 경우 v2.4.6 버전부터 직접 설정 이외에 템플릿 기능도 추가되었습니다.

이에 직접 설정 혹은 템플릿 사용 방식 중 하나를 선택해 사용하시기 바랍니다. 단, 템플릿 설정 시, 애드팝콘 사업팀(<mark style="color:blue;"><monetize@adpopcorn.com></mark>)에 사용 문의를 먼저 해주시기 바랍니다.
{% endhint %}

템플릿 사용 시에는 직접 생성과 다르게 title, description, icon, main image, cta ui component를 생성할 필요 없이 apSSPNativeAdView까지만 생성해서 영역을 설정해 주시면 됩니다.

<figure><img src="/files/S00y0ZZex3uRCzj9nkWk" alt=""><figcaption></figcaption></figure>

## 3. View controller 연결

1번, 2번 과정에서 생성한 UI component를 view controller에 outlet 연결합니다.

<figure><img src="/files/aI3DKWyoAfKWAmgmLsz8" alt=""><figcaption></figcaption></figure>

## 4. UI view를 SDK 에 전달

storyboard에서 생성한 Outlet 연결한 UI view를 <mark style="color:red;">`APSSPNativeAdRenderer`</mark>를 사용하여 sdk에 전달합니다.

storyboard에서 생성한 ui view를 APSSPNativeAdRenderer를 사용하여 sdk에 전달한다. 단, title, description, icon, main image, cta를 설정해 줄 필요 없이 최상위 view 전달과 useTemplate 값을 YES로 설정해 주시면 됩니다.

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    APSSPNativeAdRenderer *apSSPNativeAdRenderer = [[APSSPNativeAdRenderer alloc] init];
    apSSPNativeAdRenderer.apSSPNativeAdView = _apSSPNativeAdView;
    apSSPNativeAdRenderer.useTemplate = YES;
    [_adPopcornSSPNativeAd setApSSPRenderer:apSSPNativeAdRenderer superView:_apSSPNativeAdView];
}
```

{% endtab %}

{% tab title="Swift" %}

```swift
override func viewDidLoad() 
{
    super.viewDidLoad()
    apSSPNativeAdRenderer = APSSPNativeAdRenderer.init()
    apSSPNativeAdRenderer.apSSPNativeAdView = apSSPNativeAdView
    apSSPNativeAdRenderer.useTemplate = true
    adPopcornSSPNativeAd.setApSSPRenderer(apSSPNativeAdRenderer, superView: apSSPNativeAdView)
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
실제 구현 내용은 샘플 프로젝트를 통해 확인하시면 좀 더 쉽게 확인이 가능합니다.&#x20;

([샘플 프로젝트 내 NativeAdViewController.m 참고](/ssp-sdk/sdk/ios/ios-3.1.0+/undefined-13.md))
{% endhint %}
