Coder Social home page Coder Social logo

timodules's Introduction

Titanium JavaScript modules

A collection of JavaScript Modules for Titanium mobile

TabbedBar

The tabbedBar module looks and behaves almost exactly like the native iOS element (same options, event listeners etc.). In fact the module will also create the iOS tabbedBar, so it can be used in code that is shared across platforms.

Example

Usage

Use this module like you would use the native iOS tabbedBar:

Titanium

var tb = require("/path_to_module");
var bar = tb.createTabbedBar({labels:["Tab 1", "Tab 2", "Tab 3"], index:0, selectedColor: "#ffffff",tintColor: "#007AFF", top:10, width:"90%"});
    
//set the labels and index programattically after creation
bar.labels = ['one', 'two', 'three']; //alternatively use bar.setLabels()
bar.index = 2; //alternatively use bar.setIndex()
    
//get the labels and index after creation
alert(bar.labels); //alternatively use bar.getLabels()
alert(bar.index); //alternatively use bar.getIndex()

Alloy

<TabbedBar module="filename_in_lib_folder">
	<Labels>
		<Label>One</Label>
		<Label>Two</Label>
		<Label>Three</Label>
	</Labels>
</TabbedBar>

The following additional options are available for android:

  • barBorderWidth (width of the border)
  • selectedColor (text color for the selected tab)
  • color (text color - same as tintColor if undefined)
  • font (font for the buttons)

getJSON

The getJSON module provides a function similar to the jQuery getJSON with the addition of an error callback

Usage

getJSON(url, dataObject, callback, errorCallback);

Example

var mod = require("/data/getJSON");
mod.getJSON("http://api.openweathermap.org/data/2.5/weather", {q:"munich, de"}, callback, errorCallback);
		
function callback(res){
	Ti.API.info("getJSON response: "+res.weather[0].description);
}
function errorCallback(err){
	Ti.API.info(err.error);
}

timodules's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

timodules's Issues

TabbedBar Alloy Widget

The module looks great. Good job! I would love to see an Alloy widget of this. Are you planning to do this?

Support image bar items

The iOS version of the tabbed bar supports an image parameter, which if present will be used on the button instead of the title.

This is not supported in the non-ios version.

I assume it could accept a label image parameter and if it is present, don't set the label title and instead set a backgroundImage or something.

Replacing toDp function

Hey contributors,
would anyone be willing to replace the sizes that are calculated with the toDp function with density independent pixels and test them on multiple densities?
It seems like dp is now the default unit on android anyway (correct me if I'm wrong)

Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.