日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

iAd 总结

發布時間:2024/1/18 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 iAd 总结 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
iAds是SDK4.0所出現的又一新特性,只要加入Apple的iAd?Network,你就可以在程序中使用iAd為你的程序帶來額外的收益。在此之前iPhone程序中的廣告大多靠google ads實現,現在的SDK4.0的這一新特性又為我們在itunes store通過廣告上獲得收益提供了新的方法。

iAds的基本步驟
1.首先登陸你的Apple開發者ID。并且登陸到itunes connect簽署同意條款。
2.完善你的contact,bank和tax信息,這時在你的itunes connect中就多了iAds管理這一項。
3.將 iAd .framework添加到你的工程,并實現其代理。

使用方法
1.創建ADBannerView
ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
[self.view addSubview:adView];

2.廣告點擊效果設置(是否允許彈出廣告,或是退出應用程序播放廣告)返回YES為允許,willLeave表示廣告是否會離開當前應用程序
- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
????NSLog(@"Banner view is beginning an ad action");
????BOOL shouldExecuteAction = [self allowActionToRun]; // your application implements this method
????if (!willLeave && shouldExecuteAction)
????{
????????// insert code here to suspend any services that might conflict with the advertisement
????}
????return shouldExecuteAction;
}

3.顯示和隱藏廣告
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
????if (!self.bannerIsVisible)
????{
????????[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
????????// assumes the banner view is offset 50 pixels so that it is not visible.
????????banner.frame = CGRectOffset(banner.frame, 0, 50);
????????[UIView commitAnimations];
????????self.bannerIsVisible = YES;
????}
}

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
????if (self.bannerIsVisible)
????{
????????[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
????????// assumes the banner view is at the top of the screen.
????????banner.frame = CGRectOffset(banner.frame, 0, -50);
????????[UIView commitAnimations];
????????self.bannerIsVisible = NO;
????}
}

總結

以上是生活随笔為你收集整理的iAd 总结的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。