我想在我的应用程序中使用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的链接,以便我可以尝试实现该横幅。 –