0
我有一個代碼可以創建一個按鈕,具體取決於用戶何時使用iphone 4或5以及何時購買了IAP來刪除廣告。下面是它的代碼:如何檢測iAd是否使用「if」語句加載
if ((int)[[UIScreen mainScreen] bounds].size.height == 568)
{
// This is iPhone 5 screen
if (intvalue == 1) {
//No Ads
self.infoButton = [UIButton buttonWithType:UIButtonTypeInfoDark];
self.infoButton.tintColor = [UIColor whiteColor];
self.infoButton.center = CGPointMake(289, 495);
[self.view addSubview:self.infoButton];
}
else{
//Yes Ads
self.infoButton = [UIButton buttonWithType:UIButtonTypeInfoDark];
self.infoButton.tintColor = [UIColor whiteColor];
self.infoButton.center = CGPointMake(289, 451);
[self.view addSubview:self.infoButton];
}
} else {
// This is iPhone 4/4s screen
if (intvalue == 1|) {
//No Ads
self.infoButton = [UIButton buttonWithType:UIButtonTypeInfoDark];
self.infoButton.tintColor = [UIColor whiteColor];
self.infoButton.center = CGPointMake(289, 429);
[self.view addSubview:self.infoButton];
}
else{
//Yes Ads
self.infoButton = [UIButton buttonWithType:UIButtonTypeInfoDark];
self.infoButton.tintColor = [UIColor whiteColor];
self.infoButton.center = CGPointMake(289, 400);
[self.view addSubview:self.infoButton];
}
}
但是,當我的廣告沒有加載時會出現一個問題。該按鈕在屏幕上的位置應該更高。如何檢測廣告是否沒有加載將按鈕放在廣告被刪除的位置?
看看它的委託方法:'bannerViewDidLoadAd:'? – Larme