Skip to content

Instantly share code, notes, and snippets.

@revmob-sdk
Created July 27, 2012 20:23
Show Gist options
  • Save revmob-sdk/3190274 to your computer and use it in GitHub Desktop.
Save revmob-sdk/3190274 to your computer and use it in GitHub Desktop.
RevMob iOS SDK 2
#import "SampleAppViewController.h"
@implementation SampleAppViewController
- (void)viewDidLoad {
[super viewDidLoad];
CGFloat width = floorf(self.view.frame.size.width*.8);
CGFloat height = 80;
CGFloat offset = floorf((self.view.frame.size.width*.8 - width)/2);
UIButton *button = [[RevMobAds session] button];
button.frame = CGrectMake(offset,offset,height,width);
[self.view addSubview:button];
// Optional title change
[button setTitle:@"More Free Games" forState:UIControlStateNormal];
// Optional color changes
UIImage *background1 = [self imageWithColor:[UIColor grayColor]];
UIImage *background2 = [self imageWithColor:[UIColor lightGrayColor]];
[button setBackgroundImage:background1 forState:UIControlStateNormal];
[button setBackgroundImage:background2 forState:UIControlStateSelected];
// Optional rounded corner changes, require #import <QuartzCore/QuartzCore.h>
button.layer.cornerRadius = 5;
button.clipsToBounds = YES;
}
@end
RevMobFullscreen *fullscreen = [[RevMobAds session] fullscreenWithPlacementId:@"your placementId"];
[fullscreen showAd];
[[RevMobAds session] scheduleLocalNotification];
// in your AppDelegate.m
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[[RevMobAds session] processLocalNotification:notification];
}
#import <RevMobAds/RevMobAds.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[RevMobAds startSessionWithAppID:@"your AppID"]; // collect your AppID at http://revmob.com
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[SampleAppViewController alloc] init] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
@end
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[RevMobAds startSessionWithAppID:@"your AppID"];
[RevMobAds session].testingMode = RevMobAdsTestingModeWithAds;
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[RevMobAds startSessionWithAppID:@"your AppID"];
[RevMobAds session].testingMode = RevMobAdsTestingModeWithoutAds;
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment