{ "id": "139596", "key": "TIMOB-19165", "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": "17684", "name": "Release 5.2.1", "archived": false, "released": true, "releaseDate": "2016-03-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-04-21T08:06:39.000+0000", "created": "2014-11-12T13:57:18.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "TCSupportTriage", "attributedString", "color", "links", "underline" ], "versions": [], "issuelinks": [], "assignee": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-04-21T08:06:44.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": "The following test case shows you cannot override the color and underlining of links in Attributed Strings. It doesn't matter if you add the link before or after styling the same (or part of) the text you make a link.\r\n\r\nI'd like to change the color and remove the underline.\r\n\r\nh1. Test Case\r\n\r\n{code}\r\nvar win = Titanium.UI.createWindow({\r\n backgroundColor: '#ddd',\r\n});\r\n\r\nwin.add(Ti.UI.createLabel({\r\n top: 100,\r\n attributedString: Ti.UI.iOS.createAttributedString({\r\n text: 'Appcelerator always blue and underlined',\r\n attributes: [\r\n {\r\n type: Ti.UI.iOS.ATTRIBUTE_LINK,\r\n value: 'http://www.appcelerator.com',\r\n range: [0, 12]\r\n }, \r\n {\r\n type: Ti.UI.iOS.ATTRIBUTE_FOREGROUND_COLOR,\r\n value: 'red',\r\n range: [0, 12]\r\n },\r\n {\r\n type: Ti.UI.iOS.ATTRIBUTE_UNDERLINES_STYLE,\r\n value: Ti.UI.iOS.ATTRIBUTE_UNDERLINE_STYLE_NONE,\r\n range: [0, 12]\r\n }]\r\n })\r\n}));\r\n\r\nwin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "Cannot style links in Attributed Strings", "creator": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "3.4.1.RC", "closedSprints": [ { "id": 574, "state": "closed", "name": "2016 Sprint 4 SDK", "startDate": "2016-02-13T01:33:48.415Z", "endDate": "2016-02-27T01:33:00.000Z", "completeDate": "2016-02-29T03:44:48.886Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "357315", "author": { "name": "mfogg", "key": "mfogg", "displayName": "Mike Fogg", "active": true, "timeZone": "America/New_York" }, "body": "Curious, any updates on this? Seems like a pretty common thing to want to update the color of a link to match your app's interface... ", "updateAuthor": { "name": "mfogg", "key": "mfogg", "displayName": "Mike Fogg", "active": true, "timeZone": "America/New_York" }, "created": "2015-07-08T19:31:47.000+0000", "updated": "2015-07-08T19:31:47.000+0000" }, { "id": "364620", "author": { "name": "arif", "key": "arif", "displayName": "Arjan", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Still nothing on this? :-(", "updateAuthor": { "name": "arif", "key": "arif", "displayName": "Arjan", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-09-22T13:15:15.000+0000", "updated": "2015-09-22T13:15:15.000+0000" }, { "id": "364621", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hi all, please note that:\r\n{quote}\r\n ON iOS, Titanium.UI.ATTRIBUTE_LINK only supported on , with\r\n editable set to false and autoLink enabled.\r\n{quote}\r\nWill update the docs online about this soon.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-09-22T13:23:18.000+0000", "updated": "2015-09-22T13:23:18.000+0000" }, { "id": "365086", "author": { "name": "rlustemberg", "key": "rlustemberg", "displayName": "Richard Lustemberg", "active": true, "timeZone": "Europe/Berlin" }, "body": "I hope this doesn't mean the issue is closed... Titanium.UI.ATTRIBUTE_LINK does work on Ti.UI.Label, only that you cannot change underline and color. \r\nWithout being able to override the styling, it becomes unusable in almost all use cases, no matter if the property is applied to a textfield, textarea or label.", "updateAuthor": { "name": "rlustemberg", "key": "rlustemberg", "displayName": "Richard Lustemberg", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-09-28T13:29:00.000+0000", "updated": "2015-09-28T13:29:00.000+0000" }, { "id": "365088", "author": { "name": "arif", "key": "arif", "displayName": "Arjan", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Maybe, if someone would wrap this module for Titanium, it would be solved: https://github.com/TTTAttributedLabel/TTTAttributedLabel ?\r\n\r\nVia http://stackoverflow.com/questions/15381028/make-link-in-uilabel-attributedtext-not-blue-and-not-underlined?answertab=active#tab-top", "updateAuthor": { "name": "arif", "key": "arif", "displayName": "Arjan", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-09-28T13:33:43.000+0000", "updated": "2015-09-28T13:33:43.000+0000" }, { "id": "373708", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "The module [~arif] linked does seem to give a hint on how we can implement this:\r\n\r\n* https://github.com/TTTAttributedLabel/TTTAttributedLabel/blob/master/TTTAttributedLabel/TTTAttributedLabel.m#L427-L429\r\n* https://github.com/TTTAttributedLabel/TTTAttributedLabel/blob/master/TTTAttributedLabel/TTTAttributedLabel.m#L650-L652", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-01-04T08:28:27.000+0000", "updated": "2016-01-04T08:28:27.000+0000" }, { "id": "374741", "author": { "name": "dfoxinator", "key": "dfoxinator", "displayName": "David Fox", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I ran into this issue recently and it was quite frustrating. Fortunately, there is a sort of workaround, albeit it is extremely ugly. You are able to change the underline color on the link. So what I did was have a background label and a foreground label, each one with the exact same text. In the background label, you add the link with the unchangeable text color, and then in the foreground, you use the attributed string to paint over the actual link with text colored to the actual color you want it. This allows you to still use the link functionality in the label but also \"change\" its color.\r\n\r\nIt would be great if this gets fixed soon since that workaround is very ugly, but I guess it does work for most use-cases.", "updateAuthor": { "name": "dfoxinator", "key": "dfoxinator", "displayName": "David Fox", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-01-17T01:37:12.000+0000", "updated": "2016-01-17T01:37:12.000+0000" }, { "id": "374749", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~dfoxinator] we are looking into this issue this very moment and hope to add it soon.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-01-17T06:05:39.000+0000", "updated": "2016-01-17T06:05:39.000+0000" }, { "id": "374768", "author": { "name": "dfoxinator", "key": "dfoxinator", "displayName": "David Fox", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks, that's great news.", "updateAuthor": { "name": "dfoxinator", "key": "dfoxinator", "displayName": "David Fox", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-01-18T03:57:14.000+0000", "updated": "2016-01-18T03:58:04.000+0000" }, { "id": "374776", "author": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~dfoxinator] Hello David, working on a fix for the issue currently. I apologise with the delay , should be fixed very soon, thank you for the patience!. ", "updateAuthor": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-01-18T07:15:02.000+0000", "updated": "2016-01-18T07:15:02.000+0000" }, { "id": "375316", "author": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hello , the issue should be fixed now. The ability to set a color for an NSlink isn't actually supported by apples delegate however we've created a workaround the issue. So setting the color,underline style,color or any attributed string property can be set. Use the code provided to test. \r\n\r\nExpected result: Clicking any of the 2 urls should open a webView with the website hyperlinked. \r\nPR : https://github.com/appcelerator/titanium_mobile/pull/7645\r\n{code:javascript}\r\nvar win = Titanium.UI.createWindow({\r\n backgroundColor: '#ddd',\r\n});\r\nvar label = Ti.UI.createLabel({\r\n top: 100,\r\n attributedString: Ti.UI.createAttributedString({\r\n text: 'Appcelerator always blue and underlined',\r\n attributes: [\r\n {\r\n type: Ti.UI.ATTRIBUTE_LINK,\r\n value: 'http://www.appcelerator.com',\r\n range: [0, 12]\r\n }, \r\n {\r\n type: Ti.UI.ATTRIBUTE_FOREGROUND_COLOR,\r\n value: 'red',\r\n range: [0, 12]\r\n },\r\n {\r\n type: Ti.UI.iOS.ATTRIBUTE_UNDERLINES_STYLE,\r\n value: Ti.UI.iOS.ATTRIBUTE_UNDERLINE_STYLE_NONE,\r\n range: [0, 12]\r\n },\r\n {\r\n type: Ti.UI.ATTRIBUTE_LINK,\r\n value: 'https://www.youtube.com',\r\n range: [20, 4]\r\n }]\r\n })\r\n});\r\nwin.add(label);\r\nwin.open();\r\n\r\nlabel.addEventListener(\"link\",function(e)\r\n{\r\n var webview = Titanium.UI.createWebView({\r\n url:e.url,\r\n height: 300,\r\n width: 300\r\n });\r\n win.add(webview);\r\n});\r\n{code}", "updateAuthor": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-01-26T21:07:33.000+0000", "updated": "2016-01-26T21:08:17.000+0000" }, { "id": "375498", "author": { "name": "samueleast", "key": "samueleast", "displayName": "Samuel East", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Was anything resolved with this as it doesn't work for me SDK 5.1.2GA?\r\n\r\nThanks", "updateAuthor": { "name": "samueleast", "key": "samueleast", "displayName": "Samuel East", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-01-29T14:44:46.000+0000", "updated": "2016-01-29T14:44:46.000+0000" }, { "id": "375499", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~samueleast] It is in review and will be part of 5.2.0 or 5.2.1", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-01-29T15:32:49.000+0000", "updated": "2016-01-29T15:32:49.000+0000" }, { "id": "375500", "author": { "name": "samueleast", "key": "samueleast", "displayName": "Samuel East", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Awesome thanks fokke ;)", "updateAuthor": { "name": "samueleast", "key": "samueleast", "displayName": "Samuel East", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-01-29T15:41:08.000+0000", "updated": "2016-01-29T15:41:08.000+0000" }, { "id": "377186", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "New PR here: https://github.com/appcelerator/titanium_mobile/pull/7751 as Angel closed the earlier one in favor of this one.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-02-18T07:18:10.000+0000", "updated": "2016-02-18T07:20:40.000+0000" }, { "id": "377493", "author": { "name": "engross", "key": "engross", "displayName": "Dongwoo Gim", "active": true, "timeZone": "Asia/Seoul" }, "body": "I want very much, it will be part of 5.2.0. Thank you.", "updateAuthor": { "name": "engross", "key": "engross", "displayName": "Dongwoo Gim", "active": true, "timeZone": "Asia/Seoul" }, "created": "2016-02-22T08:05:35.000+0000", "updated": "2016-02-22T08:05:35.000+0000" }, { "id": "377669", "author": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR(5_2_X):https://github.com/appcelerator/titanium_mobile/pull/7771", "updateAuthor": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-02-23T21:07:30.000+0000", "updated": "2016-02-23T21:07:30.000+0000" }, { "id": "377741", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~engross] it will be part of 5.2.1", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-02-24T09:08:30.000+0000", "updated": "2016-02-24T09:08:30.000+0000" }, { "id": "377743", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~apetkov] how exactly will this PR allow you to set the color for the link. In the PR I see it hard coded to blue? Will setting a color on the same range override that?", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-02-24T09:10:33.000+0000", "updated": "2016-02-24T09:10:33.000+0000" }, { "id": "377780", "author": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~fokkezb] If you don't give the link a color or any other property it will default to blue. If a color is passed in it will override the base color and set it to wherever was passed in If.if its in the same range, like you said. If you run my example code with the master branch SDK , as the changes are merged there you will see the first link is red with no underline. Thanks :). ", "updateAuthor": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-02-24T16:44:26.000+0000", "updated": "2016-02-24T16:57:20.000+0000" }, { "id": "377857", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Thanks [~apetkov]!", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-02-25T09:08:50.000+0000", "updated": "2016-02-25T09:08:50.000+0000" }, { "id": "377908", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, using:\r\n\r\nMacOS 10.11.3 (15D21)\r\nStudio 4.5.0.201602170821\r\nTi SDK 5.2.1.v20160223221727\r\nAppc NPM 4.2.3\r\nAppc CLI 5.2.0\r\nAlloy 1.7.33\r\nXcode 7.2 (7C68)\r\n\r\nLinks can be styled in attributed strings by setting specific attributes for the link ranges (underscore, color, link). Tested using the provided test cases.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-02-25T18:30:26.000+0000", "updated": "2016-02-25T18:30:26.000+0000" }, { "id": "380463", "author": { "name": "dfoxinator", "key": "dfoxinator", "displayName": "David Fox", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I tested this on my project on 5.2.1 latest RC and the fix seems to work perfectly. Thanks!", "updateAuthor": { "name": "dfoxinator", "key": "dfoxinator", "displayName": "David Fox", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-23T03:03:42.000+0000", "updated": "2016-03-23T03:03:42.000+0000" }, { "id": "383482", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~bimmel] this issue is listed in https://wiki.appcelerator.org/display/~bimmel/Titanium+SDK+5.3.0.Beta+Release+Note#TitaniumSDK5.3.0.BetaReleaseNote-CommunityCredits but was already fixed in 5.2.1\r\n\r\n[~cng] why do issues sometimes have 2 fix versions?", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2016-04-21T07:54:19.000+0000", "updated": "2016-04-21T07:54:19.000+0000" }, { "id": "383486", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "So that if it could make it in time for the earlier version great, if not, the second version is a must.\r\nIn this case, we forgot to remove the second fix version because it actually made it in time. Please comment on Brian's release notes to inform him of the change.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-04-21T08:05:59.000+0000", "updated": "2016-04-21T08:05:59.000+0000" } ], "maxResults": 35, "total": 35, "startAt": 0 } } }