RoadMap : Admob, Getting Started > iOS 요구사항 > Banners 1

Menus : 실습



선행작업

iOS AdMob 요구사항 : http://it-backup.tistory.com/49












https://developers.google.com/mobile-ads-sdk/docs/ 주소에 접속하시면, 구글 애드몹 SDK 관련 문서를 보실 수 있고, 그 속에는 몇몇 예제들이 있습니다. 본 페이지는 그 중 'Banners I' 이라는 예제를 번역하고 따라 해본 페이지 입니다. 예제의 원문서는 https://developers.google.com/mobile-ads-sdk/docs/ 접속 후 좌측 메뉴 'AdMob > Banner Ads I'을 선택하면, 보실 수 있습니다.






Banners I (배너 1)

Google AdMob Ads banners use a small portion of the screen to entice users to "click through" to a richer, full-screen experience such as a website or app store page. This guide shows you how to enable your app to serve a banner ad.

구글 애드몹 광고 배너는 화면의 작은 부분으로 사용자의 '클릭을 통해' 웹사이트 또는 앱 스토어 페이지 같은 전체 화면 경험을 하게 합니다. 이 가이드는 앱활성화를 통해 베너 ad를 제공하는 방법을 보여줍니다.

To display Google AdMob Ads banners in your iOS app, simply add a GADBannerView to your UI.
당신의 iOS 앱에 Google AdMob Ads Banners를 표시하려면, 당신의 UI에 간단히 GADBannerView를 추가합니다.


Adding a GADBannerView

GADBannerView를 추가합니다.

iOS apps are composed of UIView objects, Objective-C instances the user sees as text areas, buttons and other controls.GADBannerView is simply a UIView subclass displaying small HTML5 ads that respond to user touch.

iOS 앱은  UIView 객체, 사용자가 바라보는 텍스트 영역, 버튼과 컨트롤의 Objective-C 인스턴스로 구성됩니다. GADBannerView는  사용자 터치에 반응하는 작은 HTML5광고를 표시하는 간단한 'UIView' 서브 클래스 입니다.

Like any UIView, a GADBannerView is easy to create in code.
UIView와 비슷한, GADBannerView는 코드로 쉽게 만듭니다.

The seven lines of code it takes to add a banner:
7줄의 코드로 배너트를 추가합니다.

  • Import GADBannerView.h
  • Declare a GADBannerView instance in your app's UIViewController
  • Create it
  • Set the ad's unit ID – your AdMob Publisher ID
  • Set the "root view controller"
  • Add the view to the UI
  • Load it with an ad

The best place to do all this is in your app's UIViewController.
당신의 앱에서 가장 좋은 곳은 'UIViewController'입니다.

// BannerExampleViewController.h

// Import GADBannerView's definition from the SDK
#import "GADBannerView.h"

@interface BannerExampleViewController : UIViewController {
 
// Declare one as an instance variable
 
GADBannerView *bannerView_;
}

@end

The following performs banner setup in the view controller's viewDidLoad initialization hook.
view 컨틀롤러의 viewDidLoad 초기화 후크 속 배너설치를 합니다.

// BannerExampleViewController.m

#import "BannerExampleViewController.h"

@implementation BannerExampleViewController

- (void)viewDidLoad {
 
[super viewDidLoad];

 
// Create a view of the standard size at the top of the screen.
 
// Available AdSize constants are explained in GADAdSize.h.
  bannerView_
= [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

 
// Specify the ad's "unit identifier". This is your AdMob Publisher ID.
  bannerView_
.adUnitID = MY_BANNER_UNIT_ID;

 
// Let the runtime know which UIViewController to restore after taking
 
// the user wherever the ad goes and add it to the view hierarchy.
  bannerView_
.rootViewController = self;
 
[self.view addSubview:bannerView_];

 
// Initiate a generic request to load it with an ad.
 
[bannerView_ loadRequest:[GADRequest request]];
}

- (void)dealloc {

 
// Don't release the bannerView_ if you are using ARC in your project // 오토 릴리즈 카운터 사용시에는 추가 하지 마세요.
 
[bannerView_ release];
 
[super dealloc];
}

@end

You can download an example project containing this code here.
이 코드가 포함된 예제 프로젝트를 다운로드 할 수 있습니다.

The Result (결과)

The outcome should be a banner at the top of your app:
결과는 당신의 앱 상단에 배너가 나와야 합니다. :

Proceed to the next guide to learn more about banner ads.

'Mobile Ads > AdMob iOS' 카테고리의 다른 글

AdMob Banners 2, iOS 예제 실습  (0) 2013.09.12
AdMob Banners 1, iOS 예제 실습  (0) 2013.09.10
iOS AdMob 요구사항  (0) 2013.09.09
Posted by 창업자닉군
,