Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 6 commits
  • 7 files changed
  • 0 commit comments
  • 2 contributors
View
0 Classes/TiViewshadowModule.h 100644 → 100755
File mode changed.
View
0 Classes/TiViewshadowModule.m 100644 → 100755
File mode changed.
View
33 README.md
@@ -8,6 +8,13 @@ The code implementing this feature has been originally posted by Javier Rayon [h
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 ###
@@ -16,15 +23,15 @@ First, you must have your XCode and Titanium Mobile SDKs in place, and have at l
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.2.zip file will be generated.
+As a result, the ti.viewshadow-iphone-0.3.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.2.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:
+You can either copy the module package (ti.viewshadow-iphone-0.3.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.2.zip -d $HOME/Library/Application\ Support/Titanium/
+ unzip -uo ti.viewshadow-iphone-0.3.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**
@@ -34,7 +41,7 @@ You can either copy the module package (ti.viewshadow-iphone-0.2.zip) to `$HOME/
Simply add the following lines to your `tiapp.xml` file:
<modules>
- <module version="0.2" platform="iphone">ti.viewshadow</module>
+ <module version="0.3" platform="iphone">ti.viewshadow</module>
</modules>
and add this line in your app.js file:
@@ -43,6 +50,24 @@ and add this line in your app.js file:
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.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
* Javier Rayon: [https://github.com/jaraen](https://github.com/jaraen ) (@jrayon)
* Olivier Morandi: [https://github.com/omorandi](https://github.com/omorandi) (@olivier_morandi)
View
66 example/app.js 100644 → 100755
@@ -1,5 +1,22 @@
+require('ti.viewshadow');
+
var win = Ti.UI.createWindow({backgroundColor:'#fff'});
-
+
+var containerView = Ti.UI.createView({
+
+ top:10,
+ width:300,
+ height:400,
+ borderRadius:20,
+ backgroundColor:'#eee',
+ shadow:{
+ shadowRadius:5,
+ shadowOpacity:1,
+ shadowOffset:{x:5, y:5}
+ }
+
+});
+
var view = Ti.UI.createView({
height:100,
width:100,
@@ -8,27 +25,40 @@ var view = Ti.UI.createView({
borderRadius:20,
backgroundColor:"green",
shadow:{
- shadowRadius:2,
+ shadowRadius:10,
shadowOpacity:0.5,
- shadowOffset:{x:4, y:4},
+ shadowOffset:{x:5, y:10}
}
})
-
+
+
var btn = Ti.UI.createButton({
- title:'Button with shadow',
+ title:'Show/hide view',
height:60,
width:200,
left:60,
- top:160
+ top:160,
+ borderRadius:10,
+ backgroundImage:'transparent',
+ backgroundColor:'#999'
});
btn.setShadow({
shadowRadius:10,
shadowOpacity:0.5,
- shadowOffset:{x:5, y:10}
+ shadowOffset:{x:5, y:10},
+ shadowColor:'#393'
});
+btn.addEventListener('click', function(){
+
+ containerView.hide();
+
+ setTimeout(function(){
+ containerView.show();
+ }, 200);
+});
var lbl = Ti.UI.createLabel({
text:'Shadow #00f',
@@ -43,16 +73,28 @@ var lbl = Ti.UI.createLabel({
});
lbl.setShadow({
- shadowRadius:3,
+ shadowRadius:5,
shadowOpacity:1,
shadowOffset:{x:0, y:0},
- shadowColor:'#00f'
+ shadowColor:'#f00'
});
-win.add(view);
-
+containerView.add(view);
+containerView.add(btn);
+containerView.add(lbl);
+win.add(containerView);
+
+/*win.add(view);
win.add(btn);
-win.add(lbl);
+win.add(lbl);*/
+
+containerView.setShadow({
+ shadowRadius:10,
+ shadowOpacity:0.5,
+ shadowOffset:{x:5, y:10},
+ shadowColor:'#393'
+});
+
win.open();
View
2 manifest
@@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
-version: 0.2
+version: 0.3
description: TiViewShadow module. Allows adding drop shadow to any Ti.UI.View
author: Javier Rayon, Olivier Morandi, Daniel Tamas
license: MIT License
View
31 tests/README
@@ -0,0 +1,31 @@
+Add tests here.
+A test file is ideally a CommonJS module that returns a factory method for creating the view under test.
+Something along the lines of:
+
+exports.createView = function() {
+
+ //code that creates and sets up the view
+
+};
+
+
+A comment is also required specifying the actual behavior and the expected behavior.
+For example:
+
+/*
+
+actual: when applying a drop shadow the whole view appears blurry on retina displays
+
+expected: no blur
+
+*/
+
+The name of the file should follow the pattern:
+
+test-<github_issue_num>.js
+
+For example:
+
+test-4.js
+
+
View
BIN ti.viewshadow-iphone-0.3.zip
Binary file not shown.

No commit comments for this range

Something went wrong with that request. Please try again.