我剛從admob更新了文件,現在用[bannerView_addSubview:closeBtn];我再也看不到按鈕了。有人可以幫我解決問題嗎?Admob和addSubview:
0
A
回答
0
以下是在.h
#import "GADBannerView.h"
AdMob
爲代碼,
和申報
GADBannerView *AdMob;
.m
#define AdMob_ID @"yourAdMobId"
然後,只需調用這個方法,並提供你的X和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];
}
0
你可以嘗試:
[bannerView_ bringSubviewToFront:closeBtn];
+0
我試過了,沒有結果......非常奇怪。無論如何,我會在self.view中添加按鈕視圖。 – Alby
相關問題
- 1. viewWithTag和addSubview
- 2. AddSubview和PresentModal問題
- 3. UITableView addSubview和錶行
- 4. UITableViewCell addSubview和CGRectMake問題
- 5. UIWindow和UIView addSubview問題
- 6. Admob和ActionScript 3
- 7. Cordova和AdMob
- 8. Admob和ListActivity
- 9. AdMob AdView和ViewPager?
- 10. Android,Maven和AdMob
- 11. Admob和ListActivity
- 12. AdMob和活動
- 13. AdMob和ActionBarSherlock
- 14. Android AdMob和Maven
- 15. AdMob和Firebase
- 16. OS4 - 窗口addSubview
- 17. addSubView到UIButton
- 18. PresentModalViewController或addsubview?
- 19. self.view addSubview:(UIView *)logInHome];
- 20. UITableView addsubview crahes
- 21. addSubview到super.superView
- 22. addSubview視圖外
- 23. addSubview動畫
- 24. Monotouch UITableViewCell AddSubView
- 25. addSubView到viewController.navigatorController
- 26. addSubView after dismissViewControllerAnimated
- 27. Addsubview not showing uiimageview
- 28. objective c addSubview order
- 29. self.view addSubview層
- 30. UISearchBar - addSubview問題?
我知道如何添加一個橫幅,問題是,我沒有看到我的UIView在GADBannerView當我使用[bannerView_ addSubview:closeBtn]; – Alby
檢查您的互聯網連接和r.testing = YES; – Rajneesh071
該廣告正確顯示!我想要一個按鈕在adview上! – Alby