BUSplashAdView.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. //
  2. // BUSplashAdView.h
  3. // BUAdSDK
  4. //
  5. // Copyright © 2017年 bytedance. All rights reserved.
  6. //
  7. #import <UIKit/UIKit.h>
  8. #import "BUMaterialMeta.h"
  9. #import "BUSplashZoomOutView.h"
  10. #import "BUMopubAdMarkUpDelegate.h"
  11. NS_ASSUME_NONNULL_BEGIN
  12. @protocol BUSplashAdDelegate;
  13. @interface BUSplashAdView : UIView <BUMopubAdMarkUpDelegate>
  14. /**
  15. The unique identifier of splash ad.
  16. */
  17. @property (nonatomic, copy, readonly, nonnull) NSString *slotID;
  18. /**
  19. Maximum allowable load timeout, default 3s, unit s.
  20. */
  21. @property (nonatomic, assign) NSTimeInterval tolerateTimeout;
  22. /**
  23. Whether hide skip button, default NO.
  24. If you hide the skip button, you need to customize the countdown.
  25. */
  26. @property (nonatomic, assign) BOOL hideSkipButton;
  27. /**
  28. The delegate for receiving state change messages.
  29. */
  30. @property (nonatomic, weak, nullable) id<BUSplashAdDelegate> delegate;
  31. /*
  32. required.
  33. Root view controller for handling ad actions.
  34. */
  35. @property (nonatomic, weak) UIViewController *rootViewController;
  36. /**
  37. Whether the splash ad data has been loaded.
  38. */
  39. @property (nonatomic, getter=isAdValid, readonly) BOOL adValid;
  40. /// media configuration parameters.
  41. @property (nonatomic, copy, readonly) NSDictionary *mediaExt;
  42. /// When it is a zoom out advertisement, it has value.
  43. @property (nonatomic, strong, readonly) BUSplashZoomOutView *zoomOutView;
  44. /**
  45. Initializes splash ad with slot id and frame.
  46. @param slotID : the unique identifier of splash ad
  47. @param frame : the frame of splashAd view. It is recommended for the mobile phone screen.
  48. @return BUSplashAdView
  49. */
  50. - (instancetype)initWithSlotID:(NSString *)slotID frame:(CGRect)frame;
  51. /**
  52. Initializes splash ad with ad slot and frame.
  53. @param slot A object, through which you can pass in the splash unique identifier、ad type, and so on
  54. @param frame the frame of splashAd view. It is recommended for the mobile phone screen.
  55. @return BUSplashAdView
  56. */
  57. - (instancetype)initWithSlot:(BUAdSlot *)slot frame:(CGRect)frame;
  58. /**
  59. Load splash ad datas.
  60. Start the countdown(@tolerateTimeout) as soon as you request datas.
  61. */
  62. - (void)loadAdData;
  63. @end
  64. @protocol BUSplashAdDelegate <NSObject>
  65. @optional
  66. /**
  67. This method is called when splash ad material loaded successfully.
  68. */
  69. - (void)splashAdDidLoad:(BUSplashAdView *)splashAd;
  70. /**
  71. This method is called when splash ad material failed to load.
  72. @param error : the reason of error
  73. */
  74. - (void)splashAd:(BUSplashAdView *)splashAd didFailWithError:(NSError * _Nullable)error;
  75. /**
  76. This method is called when splash ad slot will be showing.
  77. */
  78. - (void)splashAdWillVisible:(BUSplashAdView *)splashAd;
  79. /**
  80. This method is called when splash ad is clicked.
  81. */
  82. - (void)splashAdDidClick:(BUSplashAdView *)splashAd;
  83. /**
  84. This method is called when splash ad is closed.
  85. */
  86. - (void)splashAdDidClose:(BUSplashAdView *)splashAd;
  87. /**
  88. This method is called when splash ad is about to close.
  89. */
  90. - (void)splashAdWillClose:(BUSplashAdView *)splashAd;
  91. /**
  92. This method is called when another controller has been closed.
  93. @param interactionType : open appstore in app or open the webpage or view video ad details page.
  94. */
  95. - (void)splashAdDidCloseOtherController:(BUSplashAdView *)splashAd interactionType:(BUInteractionType)interactionType;
  96. /**
  97. This method is called when spalashAd skip button is clicked.
  98. */
  99. - (void)splashAdDidClickSkip:(BUSplashAdView *)splashAd;
  100. /**
  101. This method is called when spalashAd countdown equals to zero
  102. */
  103. - (void)splashAdCountdownToZero:(BUSplashAdView *)splashAd;
  104. @end
  105. NS_ASSUME_NONNULL_END