Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Example of NativeControls in PhoneGap
<!DOCTYPE html>
<html>
<head>
<title>NativeControls Example</title>
<!-- PhoneGap Stuff -->
<script src="phonegap-1.0.0.js" type="text/javascript" charset="utf-8"></script>
<script src="NativeControls.js" type="text/javascript" charset="utf-8"></script>
<!-- /PhoneGap Stuff -->
<script src="js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body onLoad="loaded()">
<!-- Body Stuff Goes Here -->
</body>
</html>
function loaded() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
// Initializating TabBar
nativeControls = window.plugins.nativeControls;
nativeControls.createTabBar();
// Books tab
nativeControls.createTabBarItem(
"books",
"Books",
"/www/tabs/book.png",
{"onSelect": function() {
books();
}}
);
// Stats tab
nativeControls.createTabBarItem(
"finished",
"Finished",
"/www/tabs/box.png",
{"onSelect": function() {
finished();
}}
);
// About tab
nativeControls.createTabBarItem(
"about",
"About",
"/www/tabs/info.png",
{"onSelect": function() {
about();
}}
);
// Compile the TabBar
nativeControls.showTabBar();
nativeControls.showTabBarItems("books", "finished", "about");
nativeControls.selectTabBarItem("books");
}

kanersan commented Apr 3, 2012

Great, thank you for the tutorial as well!

Nice Tutorial

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment