Objective-C,Interface Builder中的Adwhirl横幅 [英] Objective-C, Adwhirl banner in Interface Builder
问题描述
有没有人对如何在界面制作工具中制作AdWhirl横幅有任何建议?现在,我使用这个代码,以使一个横幅:
Does anyone have any suggestions on how to make a AdWhirl banner in interface builder? Right now I use this code to make a banner:
AdWhirlView *awView = [AdWhirlView requestAdWhirlViewWithDelegate:self];
[self.view addSubview:awView];
awView.frame = CGRectMake(0, 361, kAdWhirlViewWidth, kAdWhirlViewHeight);
我试图制作一个UIView并制作一个IBOutlet并使其成为AdWhirlView的类但是我似乎无法做对......
I've tried to make a UIView and making an IBOutlet to it and making it's class a AdWhirlView but I can't seem to get it right...
谢谢
推荐答案
我记得我在我的一个项目中使用了ADWhirl。我只是在这里复制代码
I remember i used ADWhirl in one of my projects something like this. I am just copying the code here
- (void)viewDidLoad {
// Add the ADView.
AdWhirlView *adWhirlView = [AdWhirlView requestAdWhirlViewWithDelegate:self];
// I use this tag to remove the ADWhirl view, as per my application settings (lite or paid)
adWhirlView.tag = ADVIEW_TAG;
adWhirlView.frame = CGRectMake(0, 412, kAdWhirlViewWidth, kAdWhirlViewHeight);
[self.view addSubview:adWhirlView];
}
然后不要忘记实现这些委托方法。
Then don't forget to implement these delegate methods.
- (NSString *)adWhirlApplicationKey {
return @"yourADWhirlAppKey";
}
- (UIViewController *)viewControllerForPresentingModalView {
return self;
}
最后,还要实现这些委托方法以便更好地进行调试。
Finally, also implement these delegate methods for better debugging.
- (void)adWhirlDidReceiveAd:(AdWhirlView *)adWhirlView;
- (void)adWhirlDidFailToReceiveAd:(AdWhirlView *)adWhirlView usingBackup:(BOOL)yesOrNo;
更新:
我收到广告使用IB中的视图后。
I am receiving ads after using the view from IB.
但它只是以编程方式使用adView的rect。我的意思是,我把adView放在中间的IB中,但它常常显示在顶部。但是,我得到了广告。
But it takes the adView's rect only programatically. I mean, i put the adView in the IB in the middle, but it used to display at the top. But yeah, i get ad's.
这篇关于Objective-C,Interface Builder中的Adwhirl横幅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!