{ "id": "164291", "key": "TIMOB-24086", "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": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-11-07T14:59:46.000+0000", "created": "2016-10-31T10:58:31.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "clickevent", "communication", "fireevent", "ios", "label", "notable" ], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2016-11-17T17:12:37.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": "Sometimes, don't know why, the Labels doesn't fire the link event.\r\n\r\nI indagated in the code, and I found that the method to get the link is by finding the index from the clicked point in the Label.\r\nThe problem is that the index, is, sometimes, wrong.\r\n\r\nI just re-implemented a more elegant version of the \"find index\", taken from here: https://github.com/AliSoftware/OHAttributedStringAdditions/blob/master/Source/UILabel%2BOHAdditions.m\r\n\r\nThis is the demo of example that doesn't works and the one that works.\r\n\r\nZIP + MOV.\r\n[tibugt.mov.zip|https://github.com/appcelerator/titanium_mobile/files/561573/tibugt.mov.zip]\r\n\r\nPR: https://github.com/appcelerator/titanium_mobile/pull/8568", "attachment": [], "flagged": false, "summary": "iOS: Label doesn't fire link event correctly", "creator": { "name": "kopiro", "key": "kopiro", "displayName": "Flavio De Stefano", "active": true, "timeZone": "Europe/Rome" }, "subtasks": [], "reporter": { "name": "kopiro", "key": "kopiro", "displayName": "Flavio De Stefano", "active": true, "timeZone": "Europe/Rome" }, "environment": null, "closedSprints": [ { "id": 752, "state": "closed", "name": "2016 Sprint 23 SDK", "startDate": "2016-11-05T00:39:37.027Z", "endDate": "2016-11-19T01:39:00.000Z", "completeDate": "2016-11-29T06:51:57.887Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "400453", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Test-Case:\r\n{code:javascript}\r\nvar win = Titanium.UI.createWindow({\r\n backgroundColor: '#ddd',\r\n});\r\n\r\nwin.open();\r\n\r\nvar text = 'Bacon ipsum dolor Appcelerator Titanium rocks! sit amet fatback leberkas salami sausage tongue strip steak.';\r\n\r\nvar attr = Titanium.UI.createAttributedString({\r\n text: text,\r\n attributes: [\r\n {\r\n type: Ti.UI.ATTRIBUTE_LINK,\r\n value: \"https:/appcelerator.com\",\r\n range: [text.indexOf('Titanium'), ('Titanium').length]\r\n },\r\n // Underlines text\r\n {\r\n type: Titanium.UI.ATTRIBUTE_UNDERLINES_STYLE,\r\n value: Ti.UI.ATTRIBUTE_UNDERLINE_STYLE_SINGLE,\r\n range: [text.indexOf('Titanium'), ('Titanium').length]\r\n }\r\n ]\r\n});\r\n\r\nvar label = Titanium.UI.createLabel({\r\n left: 20,\r\n right: 20,\r\n height: Titanium.UI.SIZE,\r\n attributedString: attr\r\n});\r\n\r\nlabel.addEventListener(\"link\", function(e) {\r\n alert(e);\r\n})\r\n\r\nwin.add(label);\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-11-05T20:41:59.000+0000", "updated": "2016-11-05T20:41:59.000+0000" }, { "id": "401363", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, using:\r\nMacOS 10.12 (16A323)\r\nStudio 4.8.0.201611121409\r\nTi SDK 6.1.0.v20161117072812\r\nAppc NPM 4.2.9-1\r\nAppc CLI 6.1.0-13\r\nAlloy 1.9.4\r\nXcode 8.1 (8B62)\r\n\r\nLink events are correctly fired for labels. Tested by using the provided sample code as well as adding many different attributes to the attributed string for the label and ensuring all link events were fired.\r\n\r\n\r\n\r\n", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-11-17T17:12:37.000+0000", "updated": "2016-11-17T17:12:37.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }