{ "id": "62069", "key": "TIMOB-1437", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-04-15T02:52:26.000+0000", "created": "2011-04-15T02:52:24.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "1.4", "defect", "horizontal", "ios", "ipad", "layout", "sdk" ], "versions": [], "issuelinks": [], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-02T19:15:38.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

The following code does not layout the components in the correct\nmanner.

\n

var viewMore = Ti.UI.createView({

\n
\nheight:20,\nwidth:150,\ntop: 90,\nright: 50,\nlayout:'horizontal'\n
\n

});

\n

var labelMore = Titanium.UI.createLabel({

\n
\ntext:\"Show More\",\nfont:{fontSize:12,fontWeight:'bold'},\ntextAlign:'right',\ncolor:'#517ca5',\nheight:20,\nright: 50\n
\n

});

\n

var imageMore = Titanium.UI.createImageView({

\n
\nimage:\"images/show-more.png\",\ntop:7,\nheight:7,\nwidth:'auto'\n
\n

});

\n

viewMore.add(labelMore);
\nviewMore.add(imageMore);

{html}", "attachment": [], "flagged": false, "summary": "Horizontal Layout broken on iPad", "creator": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "125680", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Need more context. Is this occuring in a split view, or on iPad\nin general?

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:52:24.000+0000", "updated": "2011-04-15T02:52:24.000+0000" }, { "id": "125681", "author": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Just in a regular view on the ipad. I have not tried it in a\npopover as the customer reported it as a regular view.

{html}", "updateAuthor": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:52:24.000+0000", "updated": "2011-04-15T02:52:24.000+0000" }, { "id": "125682", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Thanks for the information - I'll begin work on a fix.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:52:24.000+0000", "updated": "2011-04-15T02:52:24.000+0000" }, { "id": "125683", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I need more information. The width of the view is specified as\n50, and the label is placed at 50 right (meaning that it's aligned\nto the far-right of the view). Horizontal layout specifies that\nanything will be positioned to the right of whatever element is\nadded. This means that the label/image may be overlapping, or that\nthe image may not be drawn at all.

\n

I need to know exactly what the user is seeing and what they\nexpect the result to be. This is likely not a bug but an improper\nuse of layout constraints.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:52:25.000+0000", "updated": "2011-04-15T02:52:25.000+0000" }, { "id": "125684", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

What is the Correct Manner, anyways?

\n

In viewMore, we're given height:20 and width:150. Top and Right\naffect viewMore's placement within its parent, but for placements\nwithin viewMore, they're not important. We also have layout of\n'horizontal', which is akin to packing as if text (left to right,\nthen top to bottom). To make room for the following subviews, all\nsubviews will only be their minimum size required to place it.

\n

labelMore is a label, it has text, color, font, and text\nalignment. None of these affect labelMore's placement in and of\nthemselves, only of the text's placement within labelMore. Since\nneither height or width are set to 'auto', these can be ignored for\nthe purposes of layout.

\n

labelMore has height:20 and right:50. The required vertical\nspace for layout is 20, due to height. No width is requested, so\nthe required horizontal space for the layout will be 50 of padding\n(blank space) on the right, with the left 0 pixels containing the\nactual text.

\n

imageMore has an image. Since width is auto, the image's width\nis used and is the required vertical layout. The required vertical\nspace for the layout is top:7 + height:7 = 14.

\n
\n\n++------------+---------+-------------------------+\n||            |7 pixels space                     |\n||            +---------+                         |\n||<50 pixels >|**IMAGE**|< Where next subview     |\n|| of empty   +---------+   will start            |\n|| space      |< The remaining 100 pixels        >|\n++------------+---------+-------------------------+\n^^\n||\n0 pixels wide\n
\n

Since the label itself has a width of 0, no text will be\nvisible. The lines are there just for visualization, but won't\nactually show up. This is the correct manner that the components\nwill be laid out, according to the spec.

\n

I'm guessing he wants the layout to be a bit different. Can he\nprovide a screenshot or description of the layout so we can provide\nthe proper javascript for him to put in?

{html}", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:52:25.000+0000", "updated": "2011-04-15T02:52:25.000+0000" }, { "id": "125685", "author": { "name": "nwright", "key": "nwright", "displayName": "Nolan Wright", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

it seems like it should be this (plus he needs a width:'auto' on\nthe label):

\n
\n       main view          50 from right\n
\n

+-----------150px-----------+<----50px----> -\n<--50px-->

\n

- [label][image]

\n

+----------------------------+-------------+

\n

and the image is 7 from the top.

{html}", "updateAuthor": { "name": "nwright", "key": "nwright", "displayName": "Nolan Wright", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:52:25.000+0000", "updated": "2011-04-15T02:52:25.000+0000" }, { "id": "125686", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

back to open

{html}", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:52:26.000+0000", "updated": "2011-04-15T02:52:26.000+0000" }, { "id": "125687", "author": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

As the OP has set the container view (viewMore) to horizontal\nlayout, presumably he simply wants all elements laid out\nhorizontally. However, as Blain said, the right property on\nlabelMore and top property on imageMore is preventing this.

\n

If he wants absolute positioning of the horizontally-laid out\nelements inside viewMore he needs to create a view inside it.

\n

I think he needs to use a series of sub views, so that he can\ncombine the absolute/relative and horizontal/vertical layouts to\nreach his objective. For example:

\n
\nvar viewMore = Ti.UI.createView({\n    height:20,\n    width:150,\n    top: 90,\n    right: 50\n});\n\nvar subviewMore = Ti.UI.createView({\n    layout:'horizontal',\n    right: 50,\n    top:7\n});\n\nvar labelMore = Titanium.UI.createLabel({\n    text:\"Show More\",\n    font:{fontSize:12,fontWeight:'bold'},\n    textAlign:'right', // this is superfluous with a width being set\n    color:'#517ca5',\n    height:20\n});\n\nvar imageMore = Titanium.UI.createImageView({\n    image:\"images/show-more.png\",\n    height:7,\n    width:'auto' // this is superfluous, as it is the default\n});\n\nwin.add(viewMore);\nviewMore.add(subviewMore);\nsubviewMore.add(labelMore);\nsubviewMore.add(imageMore);\n
\n

I suspect that this ticket should be marked as invalid.

{html}", "updateAuthor": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:52:26.000+0000", "updated": "2011-04-15T02:52:26.000+0000" }, { "id": "125688", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

The constraint-based layout needs better docs. Auto is never the\ndefault, because auto is very expensive. Either way, this ticket\nshould indeed be marked as invalid

{html}", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:52:26.000+0000", "updated": "2011-04-15T02:52:26.000+0000" }, { "id": "408421", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closed as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-02T19:15:38.000+0000", "updated": "2017-03-02T19:15:38.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }