{ "id": "165133", "key": "TIMOB-24264", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": [], "resolution": null, "resolutiondate": null, "created": "2016-12-29T01:46:17.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [], "issuelinks": [], "assignee": null, "updated": "2018-02-28T19:55:32.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Hey,\r\n\r\nThat's the first time I'm trying to contribute to Titanium SDK and I want to enable the SDK to put images on the background of the listViewActionRow.\r\nWhen you swipe left if opens what you have set up on your 'editActions' component.\r\nToday this component only accepts the following properties:\r\n* color\r\n* identifier\r\n* style\r\n* title\r\n\r\nI'd like to have the property \"image\" there as well and once you set it shows the image in the background of the \"button\".\r\nThis is possible to create and I've forked the Titanium SDK framework and made a test (Check the TODO comments):\r\nhttps://github.com/xicovarisco/titanium_mobile/commit/b4ce3930023eebed5f9f20f465a6da6a9a1f4249 \r\n\r\nIn this case I've changed the file 'TiUIListView.m' in accordance with this post: http://stackoverflow.com/questions/29421894/uitableviewrowaction-image-for-title \r\n\r\nThe result can be found in the attachment.\r\nThe only thing I'm not sure how you guys deal with is: \r\n* Should I get this image as a property like the other items? (e.g. TiColor* color = [TiUtils colorValue:@\"color\" properties:prop]; )\r\n* If so, I saw that you don't have a method called `imageValue` on your TiUtils file. Should we create it?\r\n\r\nIf we sort this out we can easily release this new feature to everyone else. I'm sure everyone will appreciate it.\r\n\r\n", "attachment": [ { "id": "61153", "filename": "Screen Shot 2016-12-29 at 11.42.31 am.png", "author": { "name": "xicovarisco_orange", "key": "xicovarisco_orange", "displayName": "Francisco Ruaro Varisco", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-12-29T01:42:42.000+0000", "size": 159370, "mimeType": "image/png" }, { "id": "61154", "filename": "Simulator Screen Shot 29 Dec 2016, 12.05.26.png", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-12-29T11:05:51.000+0000", "size": 25022, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: Support ListView editActions with \"image\" property", "creator": { "name": "xicovarisco_orange", "key": "xicovarisco_orange", "displayName": "Francisco Ruaro Varisco", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "xicovarisco_orange", "key": "xicovarisco_orange", "displayName": "Francisco Ruaro Varisco", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "403905", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "body": "Looks great Francisco - can't wait to use this feature.", "updateAuthor": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2016-12-29T01:51:50.000+0000", "updated": "2016-12-29T01:51:50.000+0000" }, { "id": "403911", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Cool idea. Here is a hint on the [possible implementation|https://github.com/appcelerator/titanium_mobile/compare/master...hansemannn:TIMOB-24264?expand=1].\r\n\r\nSome general problems with this idea:\r\n- The image uses a pattern, so smaller images are always repeated\r\n- The width of the action is determined by the title, so without a \"blank title\" it looks odd\r\n- You cannot set the {{color}} property when using the {{image}} property because it would override it (actually fixed that with a hack in [this commit|https://github.com/hansemannn/titanium_mobile/commit/10f02d01c6e87726f335e4144f3dcf59a012465b])\r\n\r\nThis are native problems, not Titanium-specific ones.\r\n\r\nExample:\r\n{code:js}\r\nvar window = Ti.UI.createWindow();\r\nwindow.add(Ti.UI.createListView({\r\n sections: [Ti.UI.createListSection({\r\n items: [{\r\n properties: {\r\n title: \"Test 1\",\r\n canEdit: true,\r\n editActions: [{\r\n title: \" \",\r\n color: \"orange\",\r\n image: \"images/close3.png\"\r\n }]\r\n }\r\n }]\r\n })]\r\n})) \r\n\r\nvar nav = Ti.UI.iOS.createNavigationWindow({\r\n window: window\r\n})\r\nnav.open();\r\n{code}\r\n\r\n!Simulator Screen Shot 29 Dec 2016, 12.05.26.png|thumbnail!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-12-29T10:03:00.000+0000", "updated": "2016-12-29T11:07:07.000+0000" }, { "id": "403920", "author": { "name": "xicovarisco_orange", "key": "xicovarisco_orange", "displayName": "Francisco Ruaro Varisco", "active": true, "timeZone": "America/Los_Angeles" }, "body": "That's good @hans.\r\n\r\nSome thoughts:\r\n1) I don't think it would be a problem to ask Titanium developer to put \"blank titles\" if they want to use images on editActions. (As long as we have it documented well)\r\n2) We could create a hacky way to input blank characters to the title if the developer doesn't set the property 'title' (We could calculate the image size and based on some algorithm we input the blank spaces to fit the image), but I don't think this is a good solution, because we will be going against what Apple provides us today. I would stick to what we can do. \r\n3) Probably in the future Apple will revise this API and change some things to make it more \"maintainable\" for developers, and when this happens we better not have it hacked.\r\n\r\nOther problem I found with this solution: \r\n1) The image needs to have all the specific-sizes (@2x, @3x) to get it to work, otherwise it doesn't load the image. (I'm not sure if this is an Apple restriction for it or a Titanium-specific stuff)\r\n\r\nI'll create a pull request with the code you have created.\r\n\r\nThanks\r\n", "updateAuthor": { "name": "xicovarisco_orange", "key": "xicovarisco_orange", "displayName": "Francisco Ruaro Varisco", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-12-30T00:26:20.000+0000", "updated": "2016-12-30T00:28:24.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }