IMBanner.h
5.07 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
//
// IMBanner.h
// InMobi Monetization SDK
//
// Copyright (c) 2013 InMobi. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "InMobi.h"
#import "IMBannerDelegate.h"
#define REFRESH_INTERVAL_OFF (-1)
#pragma mark - Ad Sizes
/**
* The ad size equivalent to CGSizeMake(320, 48).
* @deprecated Will be removed in a future release. Use IM_UNIT_320x50 instead.
*/
#define IM_UNIT_320x48 9
/**
* Medium Rectangle size for the iPad (especially in a UISplitView's left pane).
* The ad size equivalent to CGSizeMake(300, 250).
*/
#define IM_UNIT_300x250 10
/**
* Leaderboard size for the iPad.
* The ad size equivalent to CGSizeMake(728,90).
*/
#define IM_UNIT_728x90 11
/**
* Full Banner size for the iPad (especially in a UIPopoverController or in
* UIModalPresentationFormSheet).
* The ad size equivalent to CGSizeMake(468x60).
*/
#define IM_UNIT_468x60 12
/**
* Skyscraper size, designed for iPad's screen size.
* The ad size equivalent to CGSizeMake(120x600).
*/
#define IM_UNIT_120x600 13
/**
* Default ad size for iPhone and iPod Touch.
* The ad size equivalent to CGSizeMake(320, 48).
*/
#define IM_UNIT_320x50 15
/**
This is a UIView class that displays banner ads. A minimum implementation to
get an ad is:
- Initialize an IMBanner instance either by providing appid and adsize or
by providing slot id.
- Load the Banner.
- Place the banner on the screen.
Below is a sample example:
banner = [[IMBanner alloc] initWithFrame:CGRectMake(0,0,320,50)
appId:@"YOUR_APP_ID"
adSize:IM_UNIT_320x50];
banner.delegate = self;
[banner loadBanner];
You may use InMobi class for additional targetting options.
*/
@interface IMBanner : UIView
#pragma mark - Initialization
/**
* Initializes an IMBanner instance with the specified appId and adSize.
* @param frame CGRect for this view, typically according to the requested size.
* @param appId Application Id registered on the InMobi portal.
* @param adSize Ad size id to request the specific banner size.
* @note |appId| is required to be non empty, else the instance of IMBanner is
* not created and nil is returned instead.
*/
- (id)initWithFrame:(CGRect)frame appId:(NSString *)appId adSize:(int)adSize;
/**
* Initializes an IMBanner instance with the specified slot id.
* @param frame CGRect for this view, typically according to the requested size.
* @param slotId Slot id to uniquely identify a placement in your app.
*/
- (id)initWithFrame:(CGRect)frame slotId:(long long)slotId;
#pragma mark - Initialization for IB Integration
/**
* Ad size id for the request.
* @note Check the ad size macros for the available values of ad-size.
*/
@property (nonatomic) int adSize;
/**
* Application Id for the request.
* @note Use the application id registered on the InMobi portal.
*/
@property (nonatomic, copy) NSString *appId;
/**
* Slot id is the specific placement id for the request.
* @note Use the slot id registered on the InMobi portal.
*/
@property (nonatomic) long long slotId;
#pragma mark - Loading Banner
/**
* Loads the Banner. Additional targetting options may be provided using the
* InMobi class.
*/
- (void)loadBanner;
/**
* Stops the current loading of the Banner if in progress.
*/
- (void)stopLoading;
#pragma mark - Optional properties
/**
* Delegate object that receives state change notifications from this view.
* Typically, this is a UIViewController instance.
* @note Whenever you're releasing the Banner, make sure you set its delegate
* to nil and remove it from its superview to prevent any chance of your
* application crashing.
*/
@property (nonatomic, weak) IBOutlet NSObject<IMBannerDelegate> *delegate;
/**
* Starts or stops the auto refresh of ads.
* The refresh interval is measured between the completion(success or failure)
* of the previous ad request and start of the next ad request. By default,
* the refresh interval is set to 60 seconds. Setting a new valid refresh
* interval value will start the auto refresh of ads if not already started.
* Use REFRESH_INTERVAL_OFF as the parameter to switch off auto refresh.
* When auto refresh is turned off, use the loadBanner method to manually load
* new ads. The SDK will not refresh ads if the screen is in the background or
* if the phone is locked.
*/
@property (nonatomic) int refreshInterval;
/**
* The animation transition, when a banner ad is refresh.
* @note: Applicable for banner ads only.
*/
@property (nonatomic,assign) UIViewAnimationTransition refreshAnimation;
/**
* A free form NSDictionary for any demographic information,
* not available via InMobi class.
*/
@property (nonatomic,strong) NSDictionary *additionaParameters;
/**
* A free form set of keywords, separated by ','
* E.g: "sports,cars,bikes"
*/
@property (nonatomic,copy) NSString *keywords;
/**
* Ref-tag key to be passed to an ad instance.
*/
@property (nonatomic,copy) NSString *refTagKey;
/**
* Ref-tag value to be passed to an ad instance.
*/
@property (nonatomic,copy) NSString *refTagValue;
@end