|
//
// IPUMobileDelegate.h
// IPUMobile
//
// Created by 秋林 on 2019/1/15.
// Copyright © 2019 Asiainfo. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <IPUFoundation/IPUFoundation.h>
@class IPUMobileWebView;
typedef void(^WebViewLoadCompletion)(void);
@protocol IPUCallbackProtocol, IPUWebViewProtocol;
typedef id<IPUCallbackProtocol, IPUWebViewProtocol> IPUCommonWebView;
@protocol IPUMobileDelegate <NSObject>
/* 获取web视图的代理监听 */
@optional
- (id)getWebViewDelegate;
/* 获取当前web视图 */
@optional
- (IPUMobileWebView *)getCurrentWebView IPU_API_DEPRECATED("use '- (IPUCommonWebView)getCurrentView' instead");
@optional
- (IPUCommonWebView)getCurrentView;
/* 获取当前的视图集合对象 */
@optional
- (id)getFlipperView;
/* 创建一个新的web视图 */
@optional
- (IPUCommonWebView)createNewWebView;
/* 设置WebView对象的样式 */
@optional
- (void)setUIWebViewStyle:(IPUCommonWebView)webView;
@optional
- (UIViewController *)getViewController;
@end
@protocol IPUCallbackProtocol <NSObject>
- (void)executeJs:(NSString *)code;
- (void)callback:(NSString *)result callbackID:(NSString *)callbackID;
- (void)callback:(NSString *)result
isEncode:(BOOL)isEncode
callbackID:(NSString *)callbackID;
- (void)error:(NSString *)message callbackID:(NSString *)callbackID;
@end
@protocol IPUWebViewProtocol <NSObject>
@optional
@property (nonatomic, strong) NSString *pageAction;
@property (nonatomic, assign) BOOL scalesPageToFit;
@property (nonatomic, weak) id delegate;
@property (nonatomic, assign) CGRect frame;
@property (nonatomic, assign) CGRect bounds;
@property (nonatomic, strong) CALayer *layer;
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, copy) WebViewLoadCompletion loadCompletion;
@property (nonatomic, strong) UIView *superview;
@property (nonatomic, assign) BOOL translatesAutoresizingMaskIntoConstraints;
- (id)initWithFrame:(CGRect)frame;
- (void)loadUrl:(NSString *)urlString;
- (void)loadLocalUrl:(NSString *)filePath;
- (void)setBaseUrl:(NSString *)basePath;
- (void)loadRequest:(NSURLRequest *)request;
- (void)loadTemplate:(NSString *) filePath data:(IPUDataMap *)data;
- (NSString *)getTemplate:(NSString *) filePath data:(IPUDataMap *) data;
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script;
- (BOOL)canGoBack;
- (void)goBack;
- (void)free;
- (void)reload;
@end
|