Skip to content

Instantly share code, notes, and snippets.

@alanleard
Created March 7, 2013 20:41
Show Gist options
  • Save alanleard/5111617 to your computer and use it in GitHub Desktop.
Save alanleard/5111617 to your computer and use it in GitHub Desktop.
Dynamic height
var win = Ti.UI.createWindow();
var leftTileView = Ti.UI.createView({
backgroundColor:"red",
height:(Math.random()*200),
width:"59%",
left:0
});
var tileContainer = Ti.UI.createView({
height:Ti.UI.SIZE,
width:Ti.UI.FILL,
borderWidth:2,
borderColor:"red"
});
tileContainer.add(leftTileView);
win.add(tileContainer);
var rightTileView = Ti.UI.createView({
width:"41%",
right:0,
height:Ti.UI.FILL
});
var rightTopTile = Ti.UI.createView({
backgroundColor:"blue",
top:0,
height:"50%"
});
var rightBottomTile = Ti.UI.createView({
backgroundColor:"green",
bottom:0,
height:"50%"
});
setTimeout(function(){
rightTileView.height = tileContainer.size.height
tileContainer.add(rightTileView);
rightTileView.add(rightTopTile);
rightTileView.add(rightBottomTile);
}, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment