-
Notifications
You must be signed in to change notification settings - Fork 0
/
GADBannerView.h
114 lines (97 loc) · 4.18 KB
/
GADBannerView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//
// GADBannerView.h
// Google AdMob Ads SDK
//
// Copyright 2011 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GADAdSize.h"
#import "GADRequest.h"
#import "GADRequestError.h"
#import "GADBannerViewDelegate.h"
// The view that displays banner ads. A minimum implementation to get an ad
// from within a UIViewController class is:
//
// // Create and setup the ad view, specifying the size and origin at {0, 0}.
// GADBannerView *adView =
// [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
// adView.rootViewController = self;
// adView.adUnitID = @"ID created when registering my app";
//
// // Place the ad view onto the screen.
// [self.view addSubview:adView];
// [adView release];
//
// // Request an ad without any additional targeting information.
// [adView loadRequest:nil];
//
@interface GADBannerView : UIView
#pragma mark Initialization
// Initializes a GADBannerView and sets it to the specified size, and specifies
// its placement within its superview bounds. If |size| is invalid, an
// instance of GADBannerView is not created and nil is returned instead.
- (id)initWithAdSize:(GADAdSize)size origin:(CGPoint)origin;
// Initializes a GADBannerView and sets it to the specified size, and specifies
// its placement at the top left of its superview. If |size| is invalid, an
// instance of GADBannerView is not created and nil is returned instead.
- (id)initWithAdSize:(GADAdSize)size;
#pragma mark Pre-Request
// Required value created in the AdSense website. Create a new ad unit for
// every unique placement of an ad in your application. Set this to the ID
// assigned for this placement. Ad units are important for targeting and stats.
// Example values for different request types:
// AdMob: a0123456789ABCD
// DFP: /0123/ca-pub-0123456789012345/my-ad-identifier
// AdSense: ca-mb-app-pub-0123456789012345/my-ad-identifier
// Mediation: AB123456789ABCDE
@property (nonatomic, copy) NSString *adUnitID;
// Required reference to the current root view controller. For example the root
// view controller in tab-based application would be the UITabViewController.
@property (nonatomic, assign) UIViewController *rootViewController;
// Required to set this banner view to a proper size. Never create your own
// GADAdSize directly. Use one of the predefined standard ad sizes
// (such as kGADAdSizeBanner), or create one using the GADAdSizeFromCGSize
// method. If not using mediation, then changing the adSize after an ad has
// been shown will cause a new request (for an ad of the new size) to be sent.
// If using mediation, then a new request may not be sent.
@property (nonatomic) GADAdSize adSize;
// Optional delegate object that receives state change notifications from this
// GADBannerView. Typically this is a UIViewController, however, if you are
// unfamiliar with the delegate pattern it is recommended you subclass this
// GADBannerView and make it the delegate. That avoids any chance of your
// application crashing if you forget to nil out the delegate. For example:
//
// @interface MyAdView : GADBannerView <GADBannerViewDelegate>
// @end
//
// @implementation MyAdView
// - (id)initWithFrame:(CGRect)frame {
// if ((self = [super initWithFrame:frame])) {
// self.delegate = self;
// }
// return self;
// }
//
// - (void)dealloc {
// self.delegate = nil;
// [super dealloc];
// }
//
// @end
//
@property (nonatomic, assign) NSObject<GADBannerViewDelegate> *delegate;
#pragma mark Making an Ad Request
// Makes an ad request. Additional targeting options can be supplied with a
// request object. Refresh the ad by calling this method again.
- (void)loadRequest:(GADRequest *)request;
#pragma mark Ad Request
// YES, if the currently displayed ad (or most recent failure) was a result of
// auto refreshing as specified on server. This will be set to NO after each
// loadRequest: method.
@property (nonatomic, readonly) BOOL hasAutoRefreshed;
#pragma mark Mediation
// Gets the underlying ad view of the mediated ad network.
// You may use this to find out the actual size of the ad and adjust
// GADBannerView to fit the underlying ad view.
@property (nonatomic, readonly) UIView *mediatedAdView;
@end