{ "id": "171160", "key": "AC-5612", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "11", "description": "Is not a bug in our product", "name": "Not Our Bug" }, "resolutiondate": "2018-02-23T10:39:02.000+0000", "created": "2018-02-22T15:02:44.000+0000", "labels": [ "apple-restriction", "attributedString", "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-02-23T10:39:09.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "*Problem*\r\n\r\nThe attribute ATTRIBUTE_STRIKETHROUGH_STYLE does not work on iOS.\r\n\r\n_actual behavior_\r\n\r\n# Run the test case\r\n# The items are not striked\r\n\r\n_expected behavior_\r\n\r\n# Run the test case\r\n# The items are striked\r\n\r\n*Test case*\r\n\r\n\r\n{code:javascript}\r\n\r\nvar products = [{\r\n\ttitle: \"Chips\",\r\n},\r\n{\r\n\ttitle: \"Tomato\",\r\n},\r\n];\r\n\r\nvar templates = {};\r\ntemplates['item'] = {\r\n\tproperties: {\r\n\t\theight: 45,\r\n\t},\r\n\tchildTemplates: [\r\n\t\t{\r\n\t\t\ttype: 'Ti.UI.Label',\r\n\t\t\tbindId: 'title',\r\n\t\t\tproperties: {\r\n\t\t\t\tcolor: \"black\",\r\n\t\t\t\theight: 40,\r\n\t\t\t}\r\n\t\t},\r\n\t],\r\n\tpreLayout: function (item) {\r\n Ti.API.info(item.meta.productTitle);\r\n\t\tvar text = item.meta.productTitle;\r\n\t\tvar attr = Ti.UI.createAttributedString({\r\n\t\t\ttext: text,\r\n\t\t\tattributes: [\r\n\t\t\t\t{\r\n\t\t\t\t\ttype: Ti.UI.ATTRIBUTE_STRIKETHROUGH_STYLE,\r\n\t\t\t\t\tvalue: Ti.UI.ATTRIBUTE_UNDERLINE_BY_WORD,\r\n\t\t\t\t\trange: [0, text.length]\r\n\t\t\t\t},\r\n\t\t\t]\r\n\t\t});\r\n\t\titem.title.attributedString = attr;\r\n\t\t//item.title.text = item.meta.productTitle;\r\n\t\treturn item;\r\n\t}\r\n};\r\nvar items = [];\r\nfor (var i = 0; i < products.length; i++) {\r\n\tproduct = products[i];\r\n\titems.push(templates['item'].preLayout({\r\n\t\tproperties: {\r\n\t\t\theight: 40,\r\n\t\t},\r\n\t\ttemplate: 'item',\r\n\t\tmeta: {\r\n\t\t\tproductTitle: product.title\r\n\t\t},\r\n\t\ttitle: {\r\n\t\t},\r\n\t}));\r\n}\r\n\r\nvar section = Ti.UI.createListSection();\r\nsection.setItems(items);\r\nvar listView = Ti.UI.createListView({\r\n backgroundColor: \"white\",\r\n\ttemplates: templates,\r\n sections: [section],\r\n});\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: \"white\",\r\n});\r\nwin.add(listView);\r\nwin.open();\r\n\r\n{code}\r\n", "attachment": [ { "id": "64887", "filename": "index.js", "author": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-22T15:01:23.000+0000", "size": 1241, "mimeType": "text/javascript" }, { "id": "64891", "filename": "test_attr_string.zip", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-23T10:35:36.000+0000", "size": 27379, "mimeType": "application/zip" } ], "flagged": false, "summary": "iOS: Attribute does not work ATTRIBUTE_STRIKETHROUGH_STYLE", "creator": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Titanium SDK version: 7.0.2.GA\r\nPlatform & version: iOS\r\nDevice Details: iOS simulator iPhone X 11.2 \r\nHost Operating System: Mac OS X 10.13.4\r\nAppc Version: 7.0.0\r\nNode version: v8.9.3\r\nXcode version: 9.2", "comment": { "comments": [ { "id": "434771", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey [~chris35], does it work with {{value: ATTRIBUTE_UNDERLINE_STYLE_SINGLE}}? Your example is a bit confusing, since the list-view related parts that take 3/4 of the example are unrelated to attributed strings.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-22T15:11:32.000+0000", "updated": "2018-02-22T15:11:32.000+0000" }, { "id": "434773", "author": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi @hknoechel\r\n\r\nThe example could be shorter :-) \r\nThe ATTRIBUTE_UNDERLINE_STYLE_SINGLE does work.\r\n", "updateAuthor": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-22T15:19:58.000+0000", "updated": "2018-02-22T15:19:58.000+0000" }, { "id": "434774", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Alright. In that case, I feel like that might be an Apple limitation as we only pass the constants. I'll try to recreate a native example to check this, but likely not this week. ", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-22T15:21:28.000+0000", "updated": "2018-02-22T15:21:28.000+0000" }, { "id": "434811", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Okay, so I was just able to reproduce the same thing on the native side as well: {{NSStrikethroughStyleAttributeName}} (Titanium: {{ATTRIBUTE_STRIKETHROUGH_STYLE}}) cannot be combined with {{NSUnderlineByWord}} (Titanium: {{ATTRIBUTE_UNDERLINE_BY_WORD}}), which looks like the expected behavior on the Apple side. If you feel different (like myself too), please file a bug report at Apple (bugreport.apple.com) and maybe they'll add it in later versions of iOS. As a workaround, you could split the text into word fragments ({{myText.splt(' ')}}) and loop through the word fragments to apply the attributes to. Thanks!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-23T10:38:52.000+0000", "updated": "2018-02-23T10:38:52.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }