Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dbankier/tintswitch

A Titanium Module to change the "ON" tint color for Titanium.UI.Switch (iOS)
https://github.com/dbankier/tintswitch

Last synced: 2 months ago
JSON representation

A Titanium Module to change the "ON" tint color for Titanium.UI.Switch (iOS)

Awesome Lists containing this project

README

        

TintSwitch
==========

This module extends the Titanium Switch to allow changing the "ON" color from the default blue color to any defined color.

_UPDATED_: You can now change the on, off, and toggle tints as well as
the on and off images. API has changed. See the example.

**NOTE**: This module is for use with iOS 5 and above and iOS only.

Compiled module is available in the _Downloads_ section.

Usage
-----

Add the following to your tiapp.xml file:

```javascript

com.yydigital.tintswitch

```

Add this line in your app.js file:

```javascript
require('com.yydigital.tintswitch');
```

The module provides no public api. It's simply used for extending the TiUISwitch class provided by the Ti SDK with additional functionality.

You will then have a the `onTint`, `offTint`, `thumbTint`, `onImage`,
`offImage` that can be used as follows:

```javascript
var sw = Ti.UI.createSwitch({
value: true,
offTint: "red",
onTint: "green",
thumbTint: "blue",
top: 50
});
```

```javascript
var sw2 = Ti.UI.createSwitch({
value: true,
offImage: "/off.png",
onImage: "/on.png",
onTint: 'purple',
bottom: 50
});
```

Credits
-------

[TiViewShadow](https://github.com/omorandi/TiViewShadow) was used for guidance in building this module.