Git Product home page Git Product logo

tiviewshadow's Introduction

TiViewShadow Module

Description

This module extends the Ti SDK, allowing to add "drop shadow" functionalities to any View object you create.

The code implementing this feature has been originally posted by Javier Rayon here.

The module is licensed under the MIT license.

TITANIUM 2 SUPPORT: Titanium 2 introduces some breaking layout changes. On iOS, now views are clipped to their bounds. Since shadows are dropped outside the view bounds, this affects seriously to this module. We tried to avoid this behavior, but in some cases the shadow does not work as expected. While we find a solution, consider that in these cases:

  • Using Ti.UI.SIZE in a parent view, could cut the shadows of its children.
  • A view with solid background and with children views can not drop shadow itself (but the children will do)

Building and installing the TiViewShadow Module

BUILD

First, you must have your XCode and Titanium Mobile SDKs in place, and have at least read the first few pages of the iOS Module Developer Guide from Appcelerator.

The build process can be launched using the build.py script that you find in the module's code root directory.

As a result, the ti.viewshadow-iphone-0.4.zip file will be generated.

NOTE: if your Titanium sdk resides in the root /Library/Application Support/Titanium/ directory, you need to change the value of the TITANIUM SDK variable in titanium.xcconfig

INSTALL

You can either copy the module package (ti.viewshadow-iphone-0.4.zip) to $HOME/Library/Application\ Support/Titanium and reference the module in your application (the Titanium SDK will automatically unzip the file in the right place), or manually launch the command:

 unzip -uo ti.viewshadow-iphone-0.4.zip -d $HOME/Library/Application\ Support/Titanium/

NOTE: if your Titanium sdk resides in the root /Library/Application Support/Titanium/ directory, change the above command accordingly

Referencing the module in your Titanium Mobile application

Simply add the following lines to your tiapp.xml file:

<modules>
    <module version="0.4" platform="iphone">ti.viewshadow</module> 
</modules>

and add this line in your app.js file:

require('ti.viewshadow');

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

Changelog

0.4:

  • View's borderRadius now affects also the shadow's shape

0.3:

  • Added support for retina displays, both iPhone and iPad

  • Added (not full) support for Titanium 2.

0.2:

  • added colorShadow property

  • performance improved using rasterization and shadowPath

0.1:

  • first version, supporting shadowOffset, shadowRadius and shadowOpacity properties.

Authors

License

Copyright (c) 2012 Javier Rayon, Olivier Morandi, Daniel Tamas

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.

tiviewshadow's People

Contributors

jaraen avatar omorandi avatar rborn avatar

Watchers

 avatar  avatar

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.