这是我第一次使用iAd并希望在UICollectionView的每5个单元格中显示它。我有两个小区的一个正常,一个用于IAD,我已连接代表对IAdCell和裁判ADBannerViewDelegateiAd UICollectionView每5个单元格
在viewDidLoad中()我有self.canDisplayBannerAds =真
在UICollectionView我使用此代码决定我想要的细胞回
覆盖FUNC的CollectionView(的CollectionView:UICollectionView,cellForItemAtIndexPath indexPath:NSIndexPath) - > UICollectionViewCell {
let isBanner = movies[indexPath.row].TmdbId == nil
if(isBanner){
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("iAdCell", forIndexPath: indexPath) as! IAdCell
return cell
}
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! LatestMovieTVCell
return cell
}
细胞看起来像这样
进口的UIKit 进口的iAd
类IAdCell:UICollectionViewCell,ADBannerViewDelegate {
@IBOutlet var IAdBanner: ADBannerView!
override func awakeFromNib() {
super.awakeFromNib()
IAdBanner.hidden = true
}
func bannerViewDidLoadAd(banner: ADBannerView!) {
banner.hidden = false
}
func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
return true
}
}
但似乎不显示广告是空
感谢 本尼