YMANativeAd
Objective-C
@protocol YMANativeAd <NSObject>
Swift
protocol YMANativeAd : NSObjectProtocol
The protocol provides methods for managing an ad and getting the values of the ad assets.
- Properties
- adType
- delegate
- Methods
- -addImageLoadingObserver:
- -removeImageLoadingObserver:
- -adAssets
- info
- ads
- -loadImages
- -bindWithAdView:error:
- -bindAdToSliderView:error:
Type of native ad. See acceptable values in YMANativeAdType
.
Declaration
Objective-C
@property (nonatomic, readonly) int adType;
Swift
unowned(unsafe) var adType: YMANativeAdView! { get }
An object implementing the YMANativeAdDelegate
protocol that receives events triggered by the user’s interaction with the ad.
Declaration
Objective-C
@property (nonatomic, weak, nullable) id<YMANativeAdDelegate> delegate;
Adds an observer that receives notifications about the image loading process.
Declaration
Objective-C
- (void)addImageLoadingObserver:
(nonnull id<YMANativeAdImageLoadingObserver>)observer;
Parameters
observer | The observer of the image loading process ( |
observer | The observer of the image loading process ( |
Removes the observer that receives notifications about the image loading process.
Declaration
Objective-C
- (void)removeImageLoadingObserver:
(nonnull id<YMANativeAdImageLoadingObserver>)observer;
Parameters
observer | The observer of the image loading process ( |
observer | The observer of the image loading process ( |
An object with ad assets (YMANativeAdAssets
).
Declaration
Objective-C
- (nonnull YMANativeAdAssets *)adAssets;
Swift
func adAssets() -> YMANativeAdAssets
Return Value
Returns an object containing the ad assets.
Any string in the ad (set in the Partner interface).
Declaration
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *info;
Swift
var info: String? { get }
An array of nested ads.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSArray<id<YMANativeAd>> *_Nonnull ads;
Swift
var ads: [YMANativeAd] { get }
Loads images if manual loading is selected.
Declaration
Objective-C
- (void)loadImages;
Swift
func loadImages()
Sets the values of all view assets for native ads and installs impression and click handlers.
Declaration
Objective-C
- (BOOL)bindWithAdView:(nonnull YMANativeAdView *)adView
error:(NSError *_Nullable *_Nullable)error;
Swift
func bind(with adView: YMANativeAdView) throws
Parameters
adView |
|
error | Information about the error (for details, see YMANativeAdErrors.h). |
adView |
|
error | Information about the error (for details, see YMANativeAdErrors.h). |
Return Value
Result of setting ad assets (YES/NO).
Configures views for displaying native ads in the slider.
Declaration
Objective-C
- (BOOL)bindAdToSliderView:(nonnull YMANativeAdView *)sliderView
error:(NSError *_Nullable *_Nullable)error;
Swift
func bindAd(toSliderView sliderView: YMANativeAdView) throws
Parameters
sliderView | The slider’s root view. |
error | Information about the error (for details, see YMANativeAdErrors.h). |
sliderView | The slider’s root view. |
error | Information about the error (for details, see YMANativeAdErrors.h). |
Return Value
Result of setting (YES/NO).