first draft of ad code for iOS. Not adding admob/adwhirl/adSesnse libs to this commit. You will need to download them to get the port to build under XCode
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
#import "EAGLView.h"
|
||||
|
||||
|
||||
|
||||
@interface EAGLViewController (PrivateMethods)
|
||||
- (NSString*)interfaceOrientationName:(UIInterfaceOrientation) interfaceOrientation;
|
||||
- (NSString*)deviceOrientationName:(UIDeviceOrientation) deviceOrientation;
|
||||
@@ -10,44 +9,44 @@
|
||||
|
||||
@implementation EAGLViewController
|
||||
|
||||
@synthesize bannerIsVisible;
|
||||
@synthesize eaglView;
|
||||
|
||||
#pragma mark initialization / deallocation methods
|
||||
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
// Custom initialization.
|
||||
CGRect frame = [[UIScreen mainScreen] applicationFrame];
|
||||
eaglView = [[EAGLView alloc] initWithFrame:frame];
|
||||
[self setView: eaglView];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[eaglView setDelegate: nil];
|
||||
[eaglView release], eaglView = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
// Implement loadView to create a view hierarchy programmatically, without using a nib.
|
||||
- (void)loadView {
|
||||
NSLog(@"EAGL ViewController - loadView");
|
||||
|
||||
CGRect frame = [[UIScreen mainScreen] applicationFrame];
|
||||
|
||||
EAGLView *eaglView = [[[EAGLView alloc] initWithFrame:frame] autorelease];
|
||||
|
||||
self.view = eaglView;
|
||||
}
|
||||
|
||||
|
||||
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
|
||||
- (void)viewDidLoad {
|
||||
NSLog(@"EAGL ViewController - view Did Load");
|
||||
|
||||
[super viewDidLoad];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
|
||||
NSLog(@"EAGL ViewController - view Will Appear");
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated
|
||||
{
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
|
||||
NSLog(@"EAGL ViewController - view Did Appear");
|
||||
@@ -62,41 +61,6 @@
|
||||
|
||||
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
// Overriden to allow any orientation.
|
||||
bool isSmallScreen = (UI_USER_INTERFACE_IDIOM()) == UIUserInterfaceIdiomPhone;
|
||||
|
||||
if ( isSmallScreen && UIInterfaceOrientationIsPortrait(interfaceOrientation))
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
|
||||
|
||||
UIDeviceOrientation currentDeviceOrientation = [UIDevice currentDevice].orientation;
|
||||
UIInterfaceOrientation currentInterfaceOrientation = self.interfaceOrientation;
|
||||
|
||||
NSLog(@"EAGL ViewController - will Rotate To Interface: %@. Current Interface: %@. Current Device: %@",
|
||||
[self interfaceOrientationName:toInterfaceOrientation],
|
||||
[self interfaceOrientationName:currentInterfaceOrientation],
|
||||
[self deviceOrientationName:currentDeviceOrientation]);
|
||||
|
||||
}
|
||||
|
||||
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
|
||||
|
||||
UIDeviceOrientation currentDeviceOrientation = [UIDevice currentDevice].orientation;
|
||||
UIInterfaceOrientation currentInterfaceOrientation = self.interfaceOrientation;
|
||||
|
||||
NSLog(@"EAGL ViewController - did Rotate From Interface: %@. Current Interface: %@. Current Device: %@",
|
||||
[self interfaceOrientationName:fromInterfaceOrientation],
|
||||
[self interfaceOrientationName:currentInterfaceOrientation],
|
||||
[self deviceOrientationName:currentDeviceOrientation]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
// Releases the view if it doesn't have a superview.
|
||||
[super didReceiveMemoryWarning];
|
||||
@@ -112,6 +76,37 @@
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
#pragma mark device orientation handlers
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
// Overriden to allow any orientation.
|
||||
bool isSmallScreen = (UI_USER_INTERFACE_IDIOM()) == UIUserInterfaceIdiomPhone;
|
||||
|
||||
if ( isSmallScreen && UIInterfaceOrientationIsPortrait(interfaceOrientation))
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
|
||||
[[eaglView adView] rotateToOrientation: toInterfaceOrientation];
|
||||
}
|
||||
|
||||
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
|
||||
|
||||
UIDeviceOrientation currentDeviceOrientation = [UIDevice currentDevice].orientation;
|
||||
UIInterfaceOrientation currentInterfaceOrientation = self.interfaceOrientation;
|
||||
|
||||
NSLog(@"EAGL ViewController - did Rotate From Interface: %@. Current Interface: %@. Current Device: %@",
|
||||
[self interfaceOrientationName:fromInterfaceOrientation],
|
||||
[self interfaceOrientationName:currentInterfaceOrientation],
|
||||
[self deviceOrientationName:currentDeviceOrientation]);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Orientation Information
|
||||
- (NSString*)interfaceOrientationName:(UIInterfaceOrientation) interfaceOrientation {
|
||||
|
||||
NSString* result = nil;
|
||||
@@ -171,6 +166,6 @@
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user