PLVWKWebView

Objective-C

@interface PLVWKWebView : WKWebView

Swift

class PLVWKWebView : WKWebView

进行适配优化的webView子类,使其满足以下需求:

  1. 当打开保利威相关域名的网页时,配置自定义UserAgent,使其支持小窗功能
  2. 支持网页音视频自动播放。
  3. 防止ipad上因误识别为Mac端浏览器导致出现白屏。
  4. 开放了 Native - JS 通信的接口。
  • 加载过的URL String

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull loadedURLString;

    Swift

    var loadedURLString: String { get }
  • Native - JS 通信 bridge

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) PLVFloatableWebViewBridge *_Nonnull bridge;

    Swift

    var bridge: PLVFloatableWebViewBridge { get }
  • 加载的页面是否支持浮窗,如果白名单不包含加载的WebView则不支持

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL supportFloatingWindow;

    Swift

    var supportFloatingWindow: Bool { get }
  • 是否允许小窗,手动配置的

    Declaration

    Objective-C

    @property (nonatomic) BOOL allowFloatingWindow;

    Swift

    var allowFloatingWindow: Bool { get set }
  • 是否开启 自动打开小窗(页面跳转则需要自动开启小窗)

    Declaration

    Objective-C

    @property (nonatomic) BOOL enableAutoFloatWindow;

    Swift

    var enableAutoFloatWindow: Bool { get set }
  • 浮窗类型(YES:系统浮窗画中画,NO:应用内浮窗) 默认为NO

    Declaration

    Objective-C

    @property (nonatomic) BOOL isSystemFloatingWindow;

    Swift

    var isSystemFloatingWindow: Bool { get set }
  • Undocumented

    Declaration

    Objective-C

    - (void)setupBridgeWithDelegate:(id)delegate;

    Swift

    func setupBridge(withDelegate delegate: Any)