iOS SDK Version

FBNativeAdCollectionViewCellProvider

Objective-C
@interfaceFBNativeAdCollectionViewCellProvider:FBNativeAdCollectionViewAdProvider
Swift
classFBNativeAdCollectionViewCellProvider:FBNativeAdCollectionViewAdProvider
Class which assists in putting FBNativeAdViews into UICollectionViews. This class manages the creation of UICollectionViewCells which host native ad views. Functionality is provided to create UICollectionCellViews as needed for a given indexPath as well as computing the height of the cells.
  • Method to create a FBNativeAdCollectionViewCellProvider.

    Declaration

    Objective-C
    -(nonnullinstancetype)initWithManager:(nonnullFBNativeAdsManager*)managerforType:(FBNativeAdViewType)type;
    Swift
    convenienceinit(manager:FBNativeAdsManager,fortype:FBNativeAdViewType)

    Parameters

  • Method to create a FBNativeAdCollectionViewCellProvider.

    Declaration

    Objective-C
    -(nonnullinstancetype)initWithManager:(nonnullFBNativeAdsManager*)managerforType:(FBNativeAdViewType)typeforAttributes:(nonnullFBNativeAdViewAttributes*)attributes;
    Swift
    init(manager:FBNativeAdsManager,fortype:FBNativeAdViewType,forattributes:FBNativeAdViewAttributes)

    Parameters

  • Helper method for implementors of UICollectionViewDataSource who would like to host native ad UICollectionViewCells in their collection view.

    Declaration

    Objective-C
    -(nonnullUICollectionViewCell*)collectionView:(nonnullUICollectionView*)collectionViewcellForItemAtIndexPath:(nonnullNSIndexPath*)indexPath;
    Swift
    funccollectionView(_collectionView:UICollectionView,cellForItemAtindexPath:IndexPath)->UICollectionViewCell
  • Helper method for implementors of UICollectionViewDelegate who would like to host native ad UICollectionViewCells in their collection view.

    Declaration

    Objective-C
    -(CGFloat)collectionView:(nonnullUICollectionView*)collectionViewheightForRowAtIndexPath:(nonnullNSIndexPath*)indexPath;
    Swift
    funccollectionView(_collectionView:UICollectionView,heightForRowAtindexPath:IndexPath)->CGFloat