I just updated the files from admob and now with [bannerView_ addSubview:closeBtn]; I can't see the button anymore.. Someone can help me out ?
Asked
Active
Viewed 286 times
2 Answers
0
Here is the code for AdMob
,
in .h
#import "GADBannerView.h"
and declare
GADBannerView *AdMob;
in .m
#define AdMob_ID @"yourAdMobId"
Then just call this method and provide your x and y
-(void)adMobCode
{
AdMob = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,410,
GAD_SIZE_320x50 .width,
GAD_SIZE_320x50.height)];
AdMob.adUnitID = AdMob_ID;
AdMob.rootViewController = self;
[self.view addSubview:AdMob];
UIButton *Yourbtn = [[UIButton alloc]initWithFrame:CGRectMake(0, AdMob.frame.origin.y, 30, 30)];
Yourbtn.tag=2;
[Yourbtn addTarget:self action:@selector(YourbtnPress:) forControlEvents:UIControlEventTouchDown];
UIImage *PlayBtnImage = [UIImage imageNamed:@"play.png"];
[Yourbtn setImage:PlayBtnImage forState:UIControlStateNormal];
[self.view addSubview:Yourbtn];
GADRequest *r = [[GADRequest alloc] init];
r.testing = YES;
[AdMob loadRequest:r];
}

Rajneesh071
- 30,846
- 15
- 61
- 74
-
I know how to add a banner, the point is that I don't see my UIview over the GADBannerView anymore when I use [bannerView_ addSubview:closeBtn]; – Alby Dec 11 '12 at 01:39
-
check your internet connection and r.testing=YES; – Rajneesh071 Dec 11 '12 at 05:55
-
the ad is displaying correctly! I want a button OVER the adview ! – Alby Dec 11 '12 at 17:14
-
so where is the big deal...just add your button over your admobVView – Rajneesh071 Dec 12 '12 at 06:39
0
Could you try:
[bannerView_ bringSubviewToFront:closeBtn];

RajPara
- 2,281
- 1
- 16
- 9
-
I tried that, no results... Very weird. Anyways, I will add the button view in self.view instead. – Alby Dec 13 '12 at 23:37