{ "id": "61282", "key": "TIMOB-650", "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": "11222", "name": "Release 1.2.0", "archived": true, "released": true, "releaseDate": "2010-04-05" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:53:48.000+0000", "created": "2011-04-15T02:33:45.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:53:48.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}

run this code in a app.js and click on any of the labels to\ntoggle their height:

\n

var win = Titanium.UI.createWindow();

\n

var y = 20;

\n

var scrollView = Titanium.UI.createScrollView({

\n
\ncontentWidth:'auto',\ncontentHeight:'auto'\n
\n

}); scrollView.layout = 'vertical';

\n

function addText(txt)
\n{

\n
\nlabel = Ti.UI.createLabel({\n    width:290,\n    height:'auto',\n    text:txt,\n    font:{fontSize:16}\n});\nview = Ti.UI.createView({\n    width:310,\n    height:'auto',\n    backgroundColor:'#22FFFF',\n    borderWidth:1,\n    top:5,\n    bottom:5\n});\nview.add(label);\n\nscrollView.add(view);\n\nlabel.addEventListener('click',function(e) {\n    if (e.source.height == 38)\n    {\n        e.source.height = 'auto';\n    }\n    else \n    {\n        e.source.height = 38;\n    }\n});\n
\n

}

\n

addText(\"1. A b c d e f g h i j k l m n o p q r s t u v w x y z\naa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu vv\nww xx yy zz. \");
\naddText(\"2. Now is the time for all good men to come to the aid of\ntheir country. Now is the time for all good men to come to the aid\nof their country. Now is the time for all good men to come to the\naid of their country. \");
\naddText(\"3. Now is the time for all good men to come to the aid of\ntheir country. Now is the time for all good men to come to the aid\nof their country. \");
\naddText(\"4. Now is the time for all good men to come to the aid of\ntheir country. Now is the time for all good men to come to the aid\nof their country. Now is the time for all good men to come to the\naid of their country. Now is the time for all good men to come to\nthe aid of their country. Now is the time for all good men to come\nto the aid of their country. Now is the time for all good men to\ncome to the aid of their country. Now is the time for all good men\nto come to the aid of their country. Now is the time for all good\nmen to come to the aid of their country. Now is the time for all\ngood men to come to the aid of their country. Now is the time for\nall good men to come to the aid of their country. \");
\naddText(\"5. Now is the time for all good men to come to the aid of\ntheir country. Now is the time for all good men to come to the aid\nof their country. Now is the time for all good men to come to the\naid of their country. Now is the time for all good men to come to\nthe aid of their country. \");

\n

win.add(scrollView);

\n

win.open()

{html}", "attachment": [], "flagged": false, "summary": "when changing from auto to fix height label does not display properly", "creator": { "name": "nwright", "key": "nwright", "displayName": "Nolan Wright", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "nwright", "key": "nwright", "displayName": "Nolan Wright", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "123733", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Bug doesn't affect just autoresize; it affects going from any\nlarger size to a smaller size. In this case, text appears to be\ntruncated to start at height 38 of the original label contents (at\nfont size 16, this means it always starts at the second line), and\nthen proceed for another 38.

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

Slight correction - the text is drawn based on the new center\npoint from the resize. So from the center point we are drawn (width\n/ 2) on either side, and (height/2) above/below the center point.\nHas to be a way to change this.

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

This one was sneaky. The view wasn't being redrawn on resize,\nand in fact this bug may affect other views which rely on the same\nbehavior. The solution is to set

\n

view.contentMode = UIViewContentModeRedraw

\n

Which forces a redraw whenever the bounds/frame/center are\nchanged. It's also worth noting that setting a view's\nbounds/frame/center also resets these other values, so a call to\nmore than one method may not be necessary (especially since it\ntriggers multiple redraws for UILabels now).

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:33:46.000+0000", "updated": "2011-04-15T02:33:46.000+0000" }, { "id": "123736", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [02900cc0c0d03deacc1d021bdd1e27df94a1b348])\nCloses #650: Set contentMode to redraw on boundary\nchange. \nhttp://github.com/appcelerator/titanium_mobile/commit/02900cc0c0d03...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:33:46.000+0000", "updated": "2011-04-15T02:33:46.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }