I'm integrating iAds for the first time. It works. What I cannot seem to do is get it at the bottom on my screen. When I do what I think is the correct math it stops showing (or rather I dont see it) but changing the position to a hardcoded value works.
// Use RootViewController manage CCEAGLView
_viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
_viewController.wantsFullScreenLayout = YES;
_viewController.view = eaglView;
// Set RootViewController to window
if ([[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
// warning: addSubView doesn't work on iOS6
[window addSubview: _viewController.view];
}
else
{
// use this method on ios6
[window setRootViewController:_viewController];
}
// iAd
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
CGRect adFrame = adView.frame;
adFrame.origin.y = adView.frame.size.height;
adView.frame = adFrame;
[_viewController.view addSubview:adView];
works but it shows like this:
When I try and change the position to the bottom based upon screen height - adView height I stop seeing it.
adFrame.origin.y = _viewController.view.frame.size.height - adView.frame.size.height;
I placed break points and it seems that this should be working based upon the values for height (1024) and adView (66)
UPDATE: I'm now trying to init specifying a rect
adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, [[UIScreen mainScreen] bounds].size.height - adView.frame.size.height, [[UIScreen mainScreen] bounds].size.width, adView.frame.size.height)];
[adView setDelegate:self];
[_viewController.view addSubview:adView];
Still not working, nothing shows anymore.
UPDATE 2: Trying this it does show, obviously not at the bottom
adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 200, [[UIScreen mainScreen] bounds].size.width, 200)];
UPDATE 3: Trying this, it does show, obviously not at the bottom
adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 200, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];
UPDATE 4: Trying this, works and it at the bottom, but I just made this up. Changing the 300 to 200 then nothing shows.
adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, [[UIScreen mainScreen] bounds].size.height - 300, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];