iOS WebView 设置回调函数

#ifdef __cplusplus

extern"C"{

#endif

#include"tolua++.h"

#ifdef __cplusplus

}

#endif

#include"cocos-ext.h"

usingnamespace::std;

usingnamespace::cocos2d;

usingnamespace::extension;

intlua_game_Text_openWap(lua_State* tolua_S)

{

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)

size_tlen;

constchar* url =lua_tolstring(tolua_S,1, &len);

intscale =lua_tonumber( tolua_S,2);

constchar* scheme =lua_tostring(tolua_S,3);

floatf = scale *0.1;

experimental::ui::WebView* pbView =experimental::ui::WebView::create();

pbView->setPosition(ccp(640,360));

autowinSize =Director::getInstance()->getWinSize();

pbView->setContentSize(winSize * f);

pbView->loadURL(url);

pbView->setScalesPageToFit(true);

pbView->setOnJSCallback(webViewCallback);  //设置url回调函数

pbView->setJavascriptInterfaceScheme(scheme);//设置返回url的头  

Director::getInstance()->getRunningScene()->addChild(pbView,90000,90000);

#endif

return1;

}











#include"UIWebView.h"

你可能感兴趣的:(iOS WebView 设置回调函数)