美文网首页
ios使用cocos2dx原生webview接入wap说明

ios使用cocos2dx原生webview接入wap说明

作者: yangying12658 | 来源:发表于2017-10-13 13:14 被阅读0次

    1、wap的具体参数拼接,可在服务器生成,具体请参考文档说明,以下着重说明如何在cocos2dx中拉起该url。

    2、加入命名空间及头文件

    #include "ui/CocosGUI.h"

    using namespace cocos2d::experimental::ui;

    2、在你拉起url的地方这样调起即可:

    WebView *webView = WebView::create();

    webView->setScalesPageToFit(true);

    webView->loadURL("alipay://");

    webView->setOnShouldStartLoading([](WebView *sender,const std::string &url){

    return true;

    });

    webView->setOnDidFinishLoading([](WebView *sender,const std::string &url){

    log("%s","加载完成");

    });

    webView->setOnDidFailLoading([](WebView *sender,const std::string &url){

    Application::getInstance()->openURL(url);

    });

    this->addChild(webView);

    相关文章

      网友评论

          本文标题:ios使用cocos2dx原生webview接入wap说明

          本文链接:https://www.haomeiwen.com/subject/wddzyxtx.html