Took me a while to figure out how to do this and despite searching, couldn't find any info on it. So here's an easy guide for anyone wanting to load a webpage in their app. The app won't have a URL bar and won't redirect to safari.
1) Download UIKIt
https://github.com/carolight/MHUIKit2) In your app, use this code:
Scene2 = gideros.class(Sprite)
function Scene2:init()
require "ui"
local webview = WebView.new('<a href="http://www.webaddresshere.com'" rel="nofollow">http://www.webaddresshere.com'</a>)
webview:setRotation(0) -- corrects orientation
webview:setPosition(0,0)
webview:setSize(1024,768);
addToRootView(webview);
end |
3) Export your app in Gideros to applications/Gideros (your gideros application folder)
4) Look for uikit.mm in the download from step 1
5) Put it into the app folder that you just exported, in plugins
6) Start Xcode and open your project exported in step 3)
7) Expand the folders in Xcode and go down to YouApplicationName/Plugins
8) Right click and choose Add Files To...
9) Choose the uikit.mm file
10) Build and run the app and the web content should load in your app.
Notes: You'll need to set autorotation on in the app settings in Gideros (right-click on project)
Comments