I am using the Alloy framework to build a mobile application in Appcelerator Studio. To build the user interface i am using the *.tss
files (sort of css) and using constants like Titanium.UI.SIZE
or Titanium.UI.FILL
for the width and height properties of the UI components.
I was wondering if there is a sort of css CALC method available in the Alloy framework, such that is possible to do size calculations like this:
width: calc(Titanium.UI.FILL - 20px)
height: calc(80% - 30px)
Thanks in advance!
If you are setting the width or height inside the .tss file, you have to set the value to an property of the Alloy global object (Alloy.CFG.yourVar or Alloy.Globals.yourVar).
alloy.js
Alloy.CFG.width = Ti.Platform.displayCaps.platformWidth - 20;
view.tss
"#myView":{
width:Alloy.CFG.width
}
If you set the value in your controller, you don't need to use like a global object property.
index.js
$.myView.width = Ti.Platform.displayCaps.platformWidth - 20;