iOS SDK Version

FBNativeAdTableViewAdProvider

Objective-C
@interfaceFBNativeAdTableViewAdProvider:NSObject
Swift
classFBNativeAdTableViewAdProvider:NSObject
Additional functionality on top of FBNativeAdsManager to assist in using native ads within a UITableView. This class contains a mechanism to map indexPaths to native ads in a stable manner as well as helpers which assist in doing the math to include ads at a regular interval within a table view.
  • Passes delegate methods from FBNativeAd. Separate delegate calls will be made for each native ad contained.

    Declaration

    Objective-C
    @property(nonatomic,weak,nullable)id<FBNativeAdDelegate>delegate;
    Swift
    weakvardelegate:FBNativeAdDelegate?{getset}
  • FBAdExtraHint to provide extra info

    Declaration

    Objective-C
    @property(nonatomic,strong,nullable)FBAdExtraHint*extraHint;
    Swift
    varextraHint:FBAdExtraHint?{getset}
  • Create a FBNativeAdTableViewAdProvider.

    Declaration

    Objective-C
    -(nonnullinstancetype)initWithManager:(nonnullFBNativeAdsManager*)manager;
    Swift
    init(manager:FBNativeAdsManager)

    Parameters

  • Retrieve a native ad for an indexPath, will return the same ad for a given indexPath until the native ads manager is refreshed. This method is intended for usage with a table view and specifically the caller is recommended to wait until tableView:cellForRowAtIndexPath: to ensure getting the best native ad for the given table cell.

    Declaration

    Objective-C
    -(nonnullFBNativeAd*)tableView:(nonnullUITableView*)tableViewnativeAdForRowAtIndexPath:(nonnullNSIndexPath*)indexPath;
    Swift
    functableView(_tableView:UITableView,nativeAdForRowAtindexPath:IndexPath)->FBNativeAd

    Parameters

    Return Value

    A FBNativeAd which is loaded and ready to be used.
  • Support for evenly distributed native ads within a table view. Computes whether this cell is an ad or not.

    Declaration

    Objective-C
    -(BOOL)isAdCellAtIndexPath:(nonnullNSIndexPath*)indexPathforStride:(NSUInteger)stride;
    Swift
    funcisAdCell(atindexPath:IndexPath,forStridestride:UInt)->Bool

    Parameters

    Return Value

    Boolean indicating whether the cell at the path is an ad
  • Support for evenly distributed native ads within a table view. Adjusts a non-ad cell indexPath to the indexPath it would be in a collection with no ads.

    Declaration

    Objective-C
    -(nullableNSIndexPath*)adjustNonAdCellIndexPath:(nonnullNSIndexPath*)indexPathforStride:(NSUInteger)stride;
    Swift
    funcadjustNonAdCellIndexPath(_indexPath:IndexPath,forStridestride:UInt)->IndexPath?

    Parameters

    Return Value

    An indexPath adjusted to what it would be in a table view with no ads
  • Support for evenly distributed native ads within a table view. Adjusts the total count of cells within the table view to account for the ad cells.

    Declaration

    Objective-C
    -(NSUInteger)adjustCount:(NSUInteger)countforStride:(NSUInteger)stride;
    Swift
    funcadjustCount(_count:UInt,forStridestride:UInt)->UInt

    Parameters

    Return Value

    The total count of cells within the table view including both ad and non-ad cells