Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13294] iOS: Allow user to control the clipping behavior of View

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-03-03T20:21:59.000+0000
Affected Version/sn/a
Fix Version/s2014 Sprint 05, 2014 Sprint 05 API, Release 3.3.0
ComponentsiOS
Labelskitchensink, qe-testadded
ReporterMartin Guillon
AssigneeVishal Duggal
Created2012-08-20T00:45:39.000+0000
Updated2014-04-28T12:07:25.000+0000

Description

a clipChildren property would be a nice addition. For example it would allow very easy implementation of drop shadow. test case
var win = Ti.UI.createWindow({fullscreen: true, backgroundColor: 'white'});
 
// this test should test that we have a red 100x100 view in the 
// center of the screen by using the size property to set it
 
var view = Ti.UI.createView({
    width:100,
    height:100,
    clipChildren:false,
    backgroundColor:"red"
});
 
var innerview = Ti.UI.createView({
    left:-20,
    right:-20,
    backgroundColor:"green"
});
 
var innerview2 = Ti.UI.createView({
    backgroundColor:"yellow"
});
 
view.add(innerview);
view.add(innerview2);
win.add(view);
 
var label = Ti.UI.createLabel({
    text:"Should be 100x100 red square in center",
    textAlign:"center",
    width:"auto",
    height:"auto",
    top:20
});
 
win.add(label);
 
 
var button = Ti.UI.createButton({
    title:"Change Size",
    width:120,
    height:40,
    bottom:20
});
win.add(button);
 
button.addEventListener('click',function() {
    view.updateLayout({
        width:150,
        height:150
    });
    label.text = "Box should now be 150x150";
});

win.open();

pull request comming

Comments

  1. Martin Guillon 2012-08-20

    pull request https://github.com/appcelerator/titanium_mobile/pull/2781
  2. Ingo Muschenetz 2013-10-08

    We unfortunately need to defer this to 3.3.0 based on some high-priority customer issues.
  3. Paul Hamilton 2014-02-21

    could shadows be added to dynamically sized elements based on contents with this property? Say with a height of Ti.UI.SIZE.
  4. Vishal Duggal 2014-02-23

    Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/5367 Test case added in KS BaseUI->Views->Shadows & Clipping https://github.com/appcelerator-developer-relations/KitchenSink/pull/142
  5. Paul Hamilton 2014-03-03

    any similiar property for android? How would we use this if we grabbed the CI build?
  6. Satyam Sekhri 2014-04-28

    The viewShadow related properties and view clipMode property working fine. Verified on: Appc Studio: 3.3.0.201404211130 SDK build: 3.3.0.v20140422163054 alloy: 1.4.0-dev CLI: titanium-3.3.0-dev titanium-code-processor:1.1.1-beta1 Xcode: 5.1.1 Osx: 10.9.2 Device: iPhone4 (7.1)

JSON Source