{ "id": "103585", "key": "AC-2111", "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": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2013-12-06T18:52:49.000+0000", "created": "2012-10-18T04:26:28.000+0000", "labels": [ "TouchEvents", "iOS", "iOS5", "tableview" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:41:05.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Hi all,\r\n\r\nWhen we are creating custom rows, and setting either of the following values in table view options, then touch event is not working for iOS mobile app.\r\n\r\n1. backgroundColor\r\n2. scrollable\r\n3. borderColor\r\n4. borderRadius\r\n5. borderWidth\r\n6. headerView\r\n\r\n{code}\r\n/**\r\n\r\n for iOS, if we are having any custom row, then touch events are not being called,\r\n if any of the following properties are available in table view options.\r\n */\r\nvar backgroundColor = options['backgroundColor'];\r\nvar scrollable = options['scrollable'];\r\nvar borderColor = options['borderColor'];\r\nvar borderRadius = options['borderRadius'];\r\nvar borderWidth = options['borderWidth'];\r\nvar headerView = options['headerView'];\r\ndelete options['backgroundColor'];\r\ndelete options['scrollable'];\r\ndelete options['borderColor'];\r\ndelete options['borderRadius'];\r\ndelete options['borderWidth'];\r\ndelete options['headerView'];\r\n\r\n/**\r\n\r\n now create table without these options, then add listener,\r\n then add table to window, and in last re-set these properties in table view\r\n **/\r\n\r\nvar tableView = UI.Common.CommonViews.table.getTableView(options);\r\n\r\nvar tStart;\r\n\r\ntableView.addEventListener('touchstart', function(e) {\r\n\tTi.API.info('touch start');\r\n\ttStart = new Date();\r\n});\r\n\r\ntableView.addEventListener('touchend', function(e) {\r\n\tvar tEnd = new Date();\r\n\r\n\tif (tEnd.getTime() - tStart.getTime() > Common.ConfigurationConstants.LONG_PRESS_TIME_GAP_CONSTANT) {\r\n\t\tTi.API.info('tableViewLongPressEvent');\r\n\t\twindow.fireEvent('tableViewLongPressEvent', e);\r\n\t} else {\r\n\t\tTi.API.info('tableViewClickEvent');\r\n\t\twindow.fireEvent('tableViewClickEvent', e);\r\n\t}\r\n\r\n});\r\n\r\nwindow.add(tableView);\r\n\r\n/**\r\n\r\n set earlier removed properties in table view\r\n **/\r\ntableView.backgroundColor = backgroundColor;\r\ntableView.scrollable = scrollable;\r\ntableView.borderColor = borderColor;\r\ntableView.borderRadius = borderRadius;\r\ntableView.borderWidth = borderWidth;\r\ntableView.headerView = headerView;\r\n\r\nreturn tableView;\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Touch events not working in custom table view rows", "creator": { "name": "ankitthakur", "key": "ankitthakur", "displayName": "Ankit Thakur", "active": true, "timeZone": "Asia/Kolkata" }, "subtasks": [], "reporter": { "name": "ankitthakur", "key": "ankitthakur", "displayName": "Ankit Thakur", "active": true, "timeZone": "Asia/Kolkata" }, "environment": "Ti 2.1.3 GA", "comment": { "comments": [ { "id": "229083", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Ankit,\r\nPlease could you change the test case to something we can run?\r\nThanks!", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-11-29T19:00:49.000+0000", "updated": "2012-11-29T19:00:49.000+0000" }, { "id": "230030", "author": { "name": "ankitthakur", "key": "ankitthakur", "displayName": "Ankit Thakur", "active": true, "timeZone": "Asia/Kolkata" }, "body": "As per the code shared, the touch event listeners on table rows are directly proportional to properties of tableview.\n\nProperties:\n1. backgroundColor\n2. scrollable\n3. borderColor\n4. borderRadius\n5. borderWidth\n6. headerView\n\nIf we are setting the above mentioned properties, before adding touch event listeners, then those are not working.", "updateAuthor": { "name": "ankitthakur", "key": "ankitthakur", "displayName": "Ankit Thakur", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2012-12-05T06:32:11.000+0000", "updated": "2012-12-05T06:32:11.000+0000" }, { "id": "246064", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Please change it to a runnable test case. Thanks.", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-05T21:20:32.000+0000", "updated": "2013-04-05T21:20:32.000+0000" }, { "id": "282869", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello,\r\n\r\nWe tested this issue the test code below. We can’t reproduce this issue. In our sample code, we have used all properties that you mentioned. Please let us know if you notice anything different. We will mark this \"resolved\" but wait for your feedback before closing this. Please keep us posted.\r\n\r\nRegards,\r\n\r\nh5. Testing Environment: \r\n\r\nOS: MAC OS X 10.8.5\r\nTi SDK: 3.1.3 GA \r\nTi CLI: 3.3.0\r\nIOS simulator 7.0\r\n\r\n\r\nh5. Test Code \r\n{code:javascript}\r\n \r\n\r\nTi.UI.setBackgroundColor('#000');\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: 'black',\r\n exitOnClose: true,\r\n fullscreen: false,\r\n title: 'TableView Demo'\r\n});\r\n\r\n// generate random number, used to make each row appear distinct for this example\r\nfunction randomInt(max){\r\n return Math.floor(Math.random() * max) + 1;\r\n}\r\n\r\nvar IMG_BASE = 'https://github.com/appcelerator/titanium_mobile/raw/master/demos/KitchenSink/Resources/images/';\r\nvar defaultFontSize = Ti.Platform.name === 'android' ? 16 : 14;\r\n\r\nvar tableData = [];\r\n\r\nfor (var i=1; i<=20; i++){\r\n var row = Ti.UI.createTableViewRow({\r\n className:'forumEvent', // used to improve table performance\r\n selectedBackgroundColor:'white',\r\n rowIndex:i, // custom property, useful for determining the row during events\r\n height:110\r\n });\r\n \r\n var imageAvatar = Ti.UI.createImageView({\r\n image: IMG_BASE + 'custom_tableview/user.png',\r\n left:10, top:5,\r\n width:50, height:50\r\n });\r\n row.add(imageAvatar);\r\n \r\n var labelUserName = Ti.UI.createLabel({\r\n color:'#576996',\r\n font:{fontFamily:'Arial', fontSize:defaultFontSize+6, fontWeight:'bold'},\r\n text:'Fred Smith ' + i,\r\n left:70, top: 6,\r\n width:200, height: 30\r\n });\r\n row.add(labelUserName);\r\n \r\n var labelDetails = Ti.UI.createLabel({\r\n color:'#222',\r\n font:{fontFamily:'Arial', fontSize:defaultFontSize+2, fontWeight:'normal'},\r\n text:'Replied to post with id ' + randomInt(1000) + '.',\r\n left:70, top:44,\r\n width:360\r\n });\r\n row.add(labelDetails);\r\n Ti.API.info('forumEvent'+ i);\r\n var imageCalendar = Ti.UI.createImageView({\r\n image:IMG_BASE + 'custom_tableview/eventsButton.png',\r\n left:70, bottom: 2,\r\n width:32, height: 32\r\n });\r\n row.add(imageCalendar);\r\n \r\n var labelDate = Ti.UI.createLabel({\r\n color:'#999',\r\n font:{fontFamily:'Arial', fontSize:defaultFontSize, fontWeight:'normal'},\r\n text:'on ' + randomInt(30) + ' Nov 2012',\r\n left:105, bottom:10,\r\n width:200, height:20\r\n });\r\n row.add(labelDate);\r\n \r\n tableData.push(row);\r\n}\r\n\r\nvar view = Titanium.UI.createView({\r\n borderRadius:10,\r\n backgroundColor:'red',\r\n width:50,\r\n height:50\r\n});\r\n\r\n\r\nvar tableView = Ti.UI.createTableView({\r\n backgroundColor: '#fff',\r\n \tscrollable: true,\r\n \tborderColor: '#111',\r\n \tborderRadius: 5,\r\n \tborderWidth: 1,\r\n \theaderView: view,\r\n data:tableData\r\n});\r\n\r\nwin.add(tableView);\r\n\r\n\r\ntableView.addEventListener('touchstart', function(e) {\r\n Ti.API.info('touch start');\r\n tStart = new Date();\r\n});\r\n \r\ntableView.addEventListener('touchend', function(e) {\r\n var tEnd = new Date(); \r\n Ti.API.info('tableViewClickEvent');\r\n});\r\n\r\nwin.open();\r\n\r\n{code} \r\n\r\n\r\nh5. Step to reproduces\r\n1.\tCreate a new project\r\n2.\tPaste test code in app.js\r\n3.\tNow run on iOS simulator \r\n4.\tClick on TableView row\r\n5.\tAnd check studio console\r\n6.\tConsole will update in event\r\n\r\n\r\nThanks\r\n", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-12-06T14:12:57.000+0000", "updated": "2013-12-06T18:52:15.000+0000" }, { "id": "282873", "author": { "name": "nunocostapt", "key": "nunocostapt", "displayName": "Nuno Costa", "active": true, "timeZone": "Europe/Lisbon" }, "updateAuthor": { "name": "nunocostapt", "key": "nunocostapt", "displayName": "Nuno Costa", "active": true, "timeZone": "Europe/Lisbon" }, "created": "2013-12-06T15:18:11.000+0000", "updated": "2013-12-06T15:18:11.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }