Skip to content

Instantly share code, notes, and snippets.

@nathanpc nathanpc/index.html
Created Nov 21, 2011

Embed
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

This comment has been minimized.

Copy link

commented Apr 3, 2012

Great, thank you for the tutorial as well!

@sat213502

This comment has been minimized.

Copy link

commented Jul 9, 2012

Nice Tutorial

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.