English 中文(简体)
Objective-C,界面生成器中的Adhury横幅
原标题:Objective-C, Adwhirl banner in Interface Builder

有人对如何在界面生成器中制作AdWhirl横幅有什么建议吗?现在,我使用以下代码制作横幅:

 AdWhirlView *awView = [AdWhirlView requestAdWhirlViewWithDelegate:self]; 

[self.view addSubview:awView];

awView.frame = CGRectMake(0, 361, kAdWhirlViewWidth, kAdWhirlViewHeight);

我试着制作一个UIView,制作一个IBOutlet,并将其列为AdWhirlView,但我似乎做不好。。。

谢谢

问题回答

以下是我在IB中使用的代码:

在SecondViewController.h中

@interface SecondViewController : UIViewController <AdWhirlDelegate> {


IBOutlet AdWhirlView *awView;


}

@property (nonatomic, retain) IBOutlet AdWhirlView *awView;

在SecondViewController.m中

@synthesize awView;


#pragma mark AdWhirlDelegate methods

- (NSString *)adWhirlApplicationKey{
return kSampleAppKey;
}

- (UIViewController *)viewControllerForPresentingModalView{
return self;
}

 awView = [AdWhirlView requestAdWhirlViewWithDelegate:self];

然后将awView连接到IB中的UIView,使用大小为320x50的类AdWhirlView

我记得我在我的一个项目中使用了ADWhirl。我只是在这里复制代码

- (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];
}

然后不要忘记实现这些委托方法。

- (NSString *)adWhirlApplicationKey {
    return @"yourADWhirlAppKey";
}

- (UIViewController *)viewControllerForPresentingModalView {
    return self;
}

最后,还要实现这些委托方法,以便更好地进行调试。

- (void)adWhirlDidReceiveAd:(AdWhirlView *)adWhirlView;
- (void)adWhirlDidFailToReceiveAd:(AdWhirlView *)adWhirlView usingBackup:(BOOL)yesOrNo;

更新:

我在使用IB的视图后收到广告。

但它只在程序上使用adView的rect。我的意思是,我把广告视图放在中间的IB,但它过去显示在顶部。但是,是的,我有广告。





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签