cocos2dx 3.x(打開網頁webView)


 

 

 1 #include "ui/CocosGUI.h"
 2 
 3  
 4 
 5 using namespace cocos2d::experimental::ui;
 6 
 7 WebView *webView = WebView::create();
 8 
 9     webView->setPosition(Vec2(visibleSize.width*0.5, visibleSize.height*0.5));
10 
11     webView->setContentSize(visibleSize);
12 
13     webView->loadURL("http://www.baidu.com");
14 
15     webView->setScalesPageToFit(true);
16 
17     webView->setOnShouldStartLoading([](WebView *sender, const std::string&url){
18 
19         
20 
21         return true;
22 
23     });
24 
25     webView->setOnDidFinishLoading([](WebView *sender, const std::string&url){
26 
27     
28 
29     });
30 
31     webView->setOnDidFailLoading([](WebView *sender, const std::string&url){
32 
33     
34 
35     });
36 
37     this->addChild(webView);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM