NKNavigationController
Overview
NKNavigationController class allows you to create navigation within application.
setTitle(title)
Sets navigation controller title for current page.
setImage(imageName)
Set navigation controller image for current page.
setTintColor(r, g, b)
sets tint color for navigation bar.
Parameters: red, green and blue component of the color
hide()
Hides navigation bar.
show()
Shows navigation bar if it was hidden.
addNavigationItem(title, callback, image)
adds a button to the right side of navigation controller.
Parameters:
title - a string title to appear on button callback - a string function name to be called when user pressed navigation item
image - name of the image to use or index of the image from standard icon list starting from 1:
UIBarButtonSystemItemDone, = 1
UIBarButtonSystemItemCancel,
UIBarButtonSystemItemEdit,
UIBarButtonSystemItemSave,
UIBarButtonSystemItemAdd,
UIBarButtonSystemItemFlexibleSpace, - does nothing
UIBarButtonSystemItemFixedSpace, - does nothing
UIBarButtonSystemItemCompose,
UIBarButtonSystemItemReply,
UIBarButtonSystemItemAction,
UIBarButtonSystemItemOrganize,
UIBarButtonSystemItemBookmarks,
UIBarButtonSystemItemSearch,
UIBarButtonSystemItemRefresh,
UIBarButtonSystemItemStop,
UIBarButtonSystemItemCamera,
UIBarButtonSystemItemTrash,
UIBarButtonSystemItemPlay,
UIBarButtonSystemItemPause,
UIBarButtonSystemItemRewind,
UIBarButtonSystemItemFastForward,
UIBarButtonSystemItemUndo,
UIBarButtonSystemItemRedo,
removeNavigationItem()
removes navigation item added by addNavigationItem() method
gotoPage(pageName)
navigates to given page creating "Back" navigation button to allow returning to the previous page - you also allowed to pass GET parameters to ʻpageNameʼ, for example:
"page.html? id=35&name=me"
see NKGetParameter function for retrieving parameters.
Parameters:
pageName - name of the page to navigate to
setStyle(style)
sets the style of navigation controller
Parameters:
style is one of two values available: "Default" and "Black" (not case sensitive).
goBack()
returns to previous page
setUsesPreloading(isUsePreloading)
manages state of automatic page preloading isUsePreloading can take state "yes", "no", "1" and "0".
destroy()
completely removes controller from page
setTitleForPage(title, page)
sets navigation controllerʼs title for specified page
popToRootView(isAnimated)
returns to the first page in pages stack either animated or instantly, can take parameters "yes"/"no" or "1"/"0"
Example:
<html>
<head>
<meta name="viewport" content="width=320,initial-scale=1, user-scalable=no" />
<script type="text/javascript" src="NKit.js"></script>
<script type="text/javascript">
var navController = new NKNavigationController();
navController.setTitle("Colored");
navController.setTintColor(0xFF, 0, 100);
</script>
</head>
<br />
<body>
<a href="#" onClick="navController.gotoPage('nextPage.html')">Go forward</a>
</body>
</html>

