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);

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2021-11-24
  • 2021-12-03
  • 2022-01-21
  • 2022-12-23
猜你喜欢
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2021-06-11
  • 2021-06-30
相关资源
相似解决方案