Layout Changes for 2.0

Futuristic technology background. Internet data connection. Cloud networks.

Hey Titanium Developers,

One area where we have really strived to improve in 2.0 is in unifying and normalizing the behavior of UI controls across platforms. This effort has resulted in much more consistent behavior between platforms overall, and will give developers more control over the behavior of UI components.

However, as we made changes to unify these APIs and achieve cross-platform parity, some behaviors have changed. Particularly around the previously ambiguous “auto” settings, and default behavior for UI components (filling the parent versus sizing to content). To help explain these changes, we have put together a special page on the wiki to describe what was changed, and provide a resource for Titanium developers upgrading from 1.8.x to 2.x.

Review the UI layout changes here.

We plan on releasing the final 2.0 builds to the world very, very soon. We hope that you’ll find this to be the best Titanium release to date, with improvements across the board in stability, performance, parity, and powerful new features. Code strong!

1 COMMENT

  1. Could you double-check the images on the wiki page about layout? I’m seeing errors along the lines of: “Unable to render embedded object: File (worddav4fb91409ce9c13430f86da138c242336.png) not found.”

  2. Nice job with the new release!

    I’m excited about using the postlayout event. Those of us who have dynamic layouts that require checking the dimensions of elements in order to position other elements have been using hacks for the last year or two, so having a standard callback that is guaranteed to have the size dimensions set is long overdue.

  3. I’m in the midst of porting an iOS app to Android. Hopefully the latest layout changes will make it easier to support the different screen resolutions on Android OS. I’m using the 2_0_X branch from appcelerator Continuous Build.

  4. Using tableview with “height : Ti.UI.SIZE will” not display the tableview at all (using iPad or iPhone Simulator/Device and Titanium SDK version: 2.1.0 (04/11/12 11:18 6b09ce4)).

    The bug still exists in every version > 1.8.2. and will be a big problem for many tableview layouts.

    Is the bug already known?

    • @mattias I think at a minimum this is probably a documentation bug, as we should explicitly define this behavior for TableView. However, I’m not sure the TableView would be the best choice for any content you’d want to “SIZE”. In most scenarios, I should think you’d be better served using a View with height:Ti.UI.SIZE and a vertical layout. If that view extends offscreen (but only sometimes), you could place it within a ScrollView. The TableView is really for displaying tabular data, moreso than providing a mechanism for layouts.

  5. In the Wiki, just under “Auto sizes in iOS” (part of the “Behavior Changes in Release 2.0” section) there is a reference to “[guides2:UI Composite Layout Behavior Spec]”. Should this be a link to something as I can’t seem to find it?

    Good work on the layout changes btw, should make things less ambiguous.

  6. Just walked away after updating my dynamic page iOS layouts to 2.0 and finally Android is behaving itself too. Great job. Still a little confused out the post layout though.