Skip to content

Instantly share code, notes, and snippets.

@rajubd49
Created April 16, 2015 07:52
Show Gist options
  • Save rajubd49/0fa8ecb156d480a5c802 to your computer and use it in GitHub Desktop.
Save rajubd49/0fa8ecb156d480a5c802 to your computer and use it in GitHub Desktop.
Actual Size of an element - Appcelerator Titanium
var win = Ti.UI.createWindow();
var view=Ti.UI.createView({
width:Ti.UI.SIZE,
height:Ti.UI.SIZE,
backgroundColor:'#fff'
});
win.addEventListener('open', function(){
Ti.API.info('View Width:'+view.size.width + ', View Height:' + view.size.height);
});
var lbl= Ti.UI.createLabel({
width:Ti.UI.SIZE,
height:Ti.UI.SIZE,
text:'Appcelerator Titanium'
});
win.addEventListener('postlayout', function(){
Ti.API.info('Label Width:' + lbl.rect.width + ', Label Height:' + lbl.rect.height);
});
win.add(view);
view.add(lbl);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment