forked from larsacus/LARSAdController
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLARSAdController.h
More file actions
87 lines (63 loc) · 4.95 KB
/
LARSAdController.h
File metadata and controls
87 lines (63 loc) · 4.95 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
//
// LARSAdController.h
// Droid Light
//
// Created by Lars Anderson on 7/24/11.
//
//Copyright (c) 2011 Lars Anderson, drink&apple, theonlylars
//
//Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
//The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <iAd/iAd.h>
#import "GADBannerViewDelegate.h"
@class GADBannerView;
@class ADBannerView;
@interface LARSAdController : NSObject <GADBannerViewDelegate, ADBannerViewDelegate>
/** The banner view instance for iAds. */
@property (nonatomic, retain) ADBannerView *iAdBannerView;
/** The banner view instance for Google Ads */
@property (nonatomic, retain) GADBannerView *googleAdBannerView;
/** The parent view that the shared instance is currently hosted in. */
@property (nonatomic, retain) UIView *parentView;
/** The parent view controller that the shared instance is currently hosted in. Typically, this is the same view controller that is managing parentView. */
@property (nonatomic, retain) UIViewController *parentViewController;
/** A boolean flag that indicates if a Google ad is currently being displayed. */
@property (nonatomic,
getter = isGoogleAdVisible) BOOL googleAdVisible;
/** A boolean flag that indicates if an iAd ad is currently being displayed. */
@property (nonatomic,
getter = isIAdVisible) BOOL iAdVisible;
/** Your google ad publisher id. */
@property (nonatomic, copy) NSString *googleAdPublisherId;
/** A boolean flag that indicates if _any_ ads are currently being displayed. */
@property (atomic,
getter = areAnyAdsVisible) BOOL anyAdsVisible;
/** A boolean flag that indicates if the shared instance should be automatically listening for and handling rotation changes.
Rotation changes will be listened for, but will only rotate if the view controller that the ads are being hosted in support the given orientation. For example, if your view controller only supports the portrait orientation, but the user changes to landscape, the ad controller will fire the code to ask your view controller if it should support the new device orientation. If your view controller returns YES, then the ad controller will layout the ad banner for that orientation.
*/
@property (nonatomic,
getter = isHandlingOrientationChanges) BOOL shouldHandleOrientationChanges;
/** The container view that the ads are contained in. Exposed so you can do anything you would want with it. */
@property (nonatomic, retain, readonly) UIView *containerView;
/** Class method that gives access to the shared instance. */
+ (LARSAdController *)sharedManager;
/** The primary method of adding your ads to a view and view controller. For some, this will be the only method that is ever called besides setting googleAdPublisherId. Call this method in every view controller's viewWillAppear method in order to add the shared ad instance to your view heirarchy.
@param view The view you would like the ad container added to.
@param viewController The view controller that will be managing the ad.
*/
- (void)addAdContainerToView:(UIView *)view withParentViewController:(UIViewController *)viewController;
/** The publisher ID to serve Google Ads using. Set this as your first call in your first view controller to set the Google ad unit ID for the shared instance.
Only needs to be set once per application launch.
@param publisherId The publisher ID that was given to you from Google to serve ads using.
*/
- (void)setGoogleAdPublisherId:(NSString *)publisherId;
/** Lays out the currently displayed banner view for the given orientation.
@warning Deprecated. You may still use this method in your view controller's willAnimateRotationFromOrientation:toOrientation: method, but using the shouldHandleOrientationChanges property to tell singleton to automatically listen for orientation changes will automatically call this method without needing to place the call in your view controller manually.
@param orientation The orientation that the ad container should layout for.
*/
- (void)layoutBannerViewsForCurrentOrientation:(UIInterfaceOrientation)orientation;
@end