我想在我的應用程序中使用Inneractive Ad SDK 5+,我想將廣告定位在底部。在任何情況下,我都試過它會始終在屏幕中間,水平和垂直居中。實施Inneractive/Inneractive橫幅廣告 - 廣告定位問題
代碼:
self.myAdView = [[IaAdView alloc]
initWithAppId:@"MyAppID_iPhone" adType:IaAdType_Banner delegate:self];
self.myAdView.adConfig.refreshIntervalInSec = 30;
[[InneractiveAdSDK sharedInstance] loadAd:self.myAdView];
委託方法:
- (void)InneractiveAdLoaded:(IaAd *)adView {
NSLog(@"AD LOADED METHOD CALLED");
// Here I tried many things I found online without any effect
[self.view addSubview:self.myAdView];
}
在這裏,我如何在viewcontroller.m文件的頂部實現屬性:
@interface ViewController() <InneractiveAdDelegate>
@property (nonatomic, retain) IaAdView* myAdView;
@end
@implementation ViewController
@synthesize myAdView = _myAdView;
我相信它一定是一件小事,但我無法弄清楚。我發現了很多解決方案,其中包括initWithFrame
,但在這種情況下這不適用。
任何幫助,將不勝感激。
更新1:
我已經試過:
- (void)InneractiveAdLoaded:(IaAd *)adView {
NSLog(@"AD LOADED METHOD CALLED");
self.myAdView.frame=CGRectMake(x,y,width,height); // With any number and random number
和
self.myAdView.frame=CGRectOffset(self.myAdView.frame, 0, yOffset); // With any number and random number
[self.view addSubview:self.myAdView];
}
沒有什麼幫助。廣告保持絕對中心。我開始認爲設置有問題,但除了定位一切工作正常。見下面的照片。
更新2:
嘗試沒有成功以下。 ios8顯示橫幅集中在屏幕上,ios7出於某種原因一旦添加了該行就完全沒有了。
- (void)InneractiveAdLoaded:(IaAd *)adView {
NSLog(@"AD LOADED METHOD CALLED");
self.myAdView.frame = CGRectMake(0, self.view.frame.size.height - self.myAdView.frame.size.height , self.view.frame.size.width, self.myAdView.frame.size.height);
[self.view addSubview:self.myAdView];
}
爲什麼你使用'self.myAdView'?你還在創建一個屬性嗎? –
是的。 SDK請求實現它,以便像我上面做的編輯一樣進行理解。 – SunnySonic
將'@synthesize myAdView = _myAdView;'更改爲'@synthesize myAdView;'另外,您能否提供一個指向SDK的鏈接,以便我可以嘗試實現該橫幅。 –