mox开发记录
2017-11-07 本文已影响13人
邹四木
webviewjs相互调用接口
js调用native接口
窗口布局viewLayoutHandle
web端启动窗口即调用,设置窗体在移动端展示位置
参数名 | 类型 | 参数说明 |
---|---|---|
layoutType | NSInteger | 布局方式,1为坐标布局,2为比例布局 |
x | float | x坐标(视图左上角为坐标原点) |
y | float | y坐标 |
cornerRadius | float | 圆角 |
centerX | float | 中心点X坐标 (不使用设为0或不传) |
centerY | float | 中心点Y坐标 (不使用设为0或不传) |
width | float | 视图宽度 (type为1时传入) |
height | float | 视图高度 (type为1时传入) |
widthScale | float | 视图宽度在屏幕占比 (type为2时传入) |
heightScale | float | 视图高度在屏幕占比 (type为2时传入) |
message | NSString | 备注信息 |
关闭窗口closeViewHandle
web端调用通知native关闭本窗口
参数名 | 类型 | 参数说明 |
---|---|---|
pageCloseType | int | 1.pop、2.dismiss 3.close |
popPath | NSString | 退出路径 (只能在pop页面调用,不填写则返回至上一页,rootPage返回根界面) |
message | NSString | 备注信息 |
打开新窗口openViewHandle
web端调用通知native打开一个窗口
参数名 | 类型 | 参数说明 |
---|---|---|
pageOpenType | Int | 1.push 2.present 3.pop_up 页面打开类型 |
isNativeControl | Bool | 是否有原生窗口 |
pagePath | NSString | 窗口路径 |
pageTitle | NSString | 窗口名 |
pageClass | NSString | 原生窗口类名(native需要判断本地是否存在这个类,不存在按通用窗体处理) |
message | NSString | 备注信息 |
js调用nativa发起网络请求requestThoughNativeHandle
web端调用native发起网络请求,网络请求加密信息保存在native,native发送加密后的请求并向web端返回请求结果
data参数名 | 类型 | 参数说明 |
---|---|---|
requestUrlStr | NSString | 请求接口名 |
paraDic | Dictionary | 请求参数 |
requestTitle | NSString | 网络请求名 |
isUiEnable | Bool | 请求的时候是否禁用UI交互(默认不用为NO) |
isUseHUD | Bool | 请求是否显示HUD(默认不使用为NO) |
response
返回数据
参数名 | 类型 | 参数说明 |
---|---|---|
responseStatu | int | 请求状态1.成功 2.失败 3.超时 4.异常 |
responseMessage | NSString | 请求状态字符串 |
responseData | Dictionary | 请求返回数据 |
弹出提示框 openActivityViewHandle
js调用native弹出提示框
参数名 | 类型 | 参数说明 |
---|---|---|
displayTime | float | 如果输入了这个参数,则提示框风格变为短暂显示的提示视图,下面的参数只传入title |
title | NSString | 提示框标题 |
message | NSString | 提示框内容 |
isTextFiled | Bool | 是否需要输入框 |
actionArr | Array | 提示框按钮数组(string类型) |
参数名 | 类型 | 参数说明 |
---|---|---|
touchIndex | int | 点击的按钮 |
inputMsg | NSString | 用户输入框中输入的信息(没有则为空) |
response
参数名 | 类型 | 参数说明 |
---|---|---|
touchIndex | int | 点击的按钮 |
inputMsg | NSString | 用户输入框中输入的信息(没有则为空) |