This module extends the native UI components provided by the Titanium Mobile SDK. We are more properties to a bunch of UI components, giving you more freedom for styling and functionality.
This is not a set of new UI components. Instead, we are extending the existing framework.
See this module as a collection of extended functionality. I did not invent all of the below functionality, but want to put these together in one united module.
Simply add the following lines to your tiapp.xml
file:
<modules>
<module platform="iphone">dk.napp.ui</module>
</modules>
Instantiate the module through require();
This will modify and override the native Titanium classes with the NappUI methods.
Note: Creating a NappUI
object is optional, but may be useful if methods, properties or custom proxy objects are defined.
var NappUI = require("dk.napp.ui");
The following lists the UI components and its new extended functionality.
var win = Ti.UI.createWindow({
blur:0.2
});
var win = Ti.UI.createWindow({
staticBlur: {
enabled: true,
type: "tint",
tint: "#00ff00"
}
});
//See example/app.js for all applicable types
var view = Ti.UI.createView({
shadow:{
shadowRadius:10,
shadowOpacity:1,
shadowOffset:{x:2, y:2}
},
blur:0.75
});
var view = Ti.UI.createView({
staticBlur: {
enabled: true,
type: "light"
}
});
//See example/app.js for all applicable types
var image = Ti.UI.createImageView({
image:"image.png",
recognizeSimultaneously:"pinching,rotate",
rotateGesture:true,
pinchingGesture:true,
panGesture:true
});
image.addEventListener('pan', function(e){});
image.addEventListener('panend', function(e){});
image.addEventListener('rotate', function(e){});
image.addEventListener('rotateend', function(e){});
image.addEventListener('pinching', function(e){});
image.addEventListener('pinchingend', function(e){});
image.addEventListener('pan', function(e){});
image.addEventListener('panend', function(e){});
var webView = Ti.UI.createWebView({
normalScrollSpeed: true,
removeShadow: true,
removeScrollDelay: true,
userAgentForiOS: 'My Awesome Application UserAgent'
url: 'http://www.appcelerator.com'
});
webView.addEventListener('fromWebView', function(){});
var scrollableView = Ti.UI.createScrollableView({
views:[view1,view2,view3],
showPagingControl:true,
pagingControlCurrentIndicatorColor:"blue",
pagingControlIndicatorColor: "red"
});
var tabGroup = Ti.UI.createTabGroup({
customBackgroundColor: "#151515",
customBackgroundImage: "/images/tabbg.png",
customActiveIndicator: "/images/activeIndicator.png",
customActiveIconColor: "#FF3300"
});
var textfield = Ti.UI.createTextField({
hintTextColor:"red"
});
var searchBar = Ti.UI.createSearchBar({
searchFieldBackgroundImage:"searchbg.png",
showsScopeBar:true,
scopeButtonTitles:["hello", "yes"],
customCancel:{
barColor:"#333",
color:"#ddd",
title:"Hit me",
font:{
fontSize:16,
fontWeight:"bold",
fontFamily:"Georgia"
}
},
appearance:Titanium.UI.KEYBOARD_APPEARANCE_ALERT,
barColor:"transparent",
disableSearchIcon:true //disables the search icon in the left side
});
var picker = Ti.UI.createPicker({
mask:{
left:14,
top:10,
width:293,
height:196
}
});
var toolbar = Ti.UI.iOS.createToolbar({
items:[send, flexSpace, camera],
tintColor:"red"
});
navGroup.popToRoot();
var string = "This is an example string";
var label = Ti.UI.createLabel({
width: Ti.UI.FILL,
text: string,
font: {
fontFamily: "Avenir-Roman",
fontSize: 16
},
attributedText: {
text: string, // String
attributes: [ // Array
{ // Object
text: "example",
color: "blue"
},
{
text: "string",
font: {
fontFamily: "Avenir-Medium",
fontSize: 16
}
}
]
}
});
win.add(label);
A more extensive example is included in /example/app.js
1.2
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1
1.0.4
1.0.3
1.0.2
1.0.1
1.0
Mads Møller
web: http://www.napp.dk
email: mm@napp.dk
twitter: @nappdev
Copyright (c) 2010-2013 Mads Møller
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.