{ "id": "135895", "key": "TIMOB-19523", "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": [], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-10-23T23:43:24.000+0000", "created": "2014-08-29T10:33:17.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "TCSupportTriage", "defaultImage", "height", "imageview", "ios", "listview", "load" ], "versions": [], "issuelinks": [], "assignee": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-05-23T09:06:46.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": "I have a listview, which displays remote images of different dimensions. While images are loaded, I show defaultImage with spinner.\r\nHere's a template I have for this\r\n{code:title=template|borderStyle=solid}\r\n{\r\n bindId: 'main',\r\n properties: {height: Ti.UI.SIZE},\r\n childTemplates: [\r\n {\r\n type: 'Ti.UI.ImageView',\r\n bindId: 'image',\r\n properties: {\r\n width: Ti.UI.SIZE,\r\n height: Ti.UI.SIZE,\r\n defaultImage: 'icon_spinner_wide.png'\r\n }\r\n }\r\n ]\r\n}\r\n{code}\r\n\r\nOnce list is displayed, default image is shown, and ImageView has height and width according to default image. The problem is that as soon as remote image is loaded (and cached), it is displayed, but the height remains same as it was for default image. If I open the list 2nd time, it works fine, because the image is not remote anymore and could be shown immediately, without default image.\r\n\r\nI've tried to add event listener to 'load' event for image (in order to adjust list item height), so template looks like this:\r\n{code:title=imageview+loadhandler|borderStyle=solid}\r\ntype: 'Ti.UI.ImageView',\r\nbindId: 'image',\r\nproperties: {\r\n width: Ti.UI.SIZE,\r\n height: Ti.UI.SIZE,\r\n defaultImage: 'icon_spinner_wide.png'\r\n},\r\nevents: {\r\n load: function(e) {\r\n alert('hello');\r\n }\r\n}\r\n{code}\r\nbut unfortunately as soon as 'load' event handler is declared, I get following error on listview.setSections:\r\n*** setObjectForKey: object cannot be nil (key: section)\r\nIf I add handler for click event, it works. Probably these 2 issues are connected.\r\nAlso it works on Android (both resize after remote image is loaded and load event).\r\n", "attachment": [], "flagged": false, "summary": "IOS: ImageView within ListView with defaultImage set is not resized accordingly to remote image", "creator": { "name": "lees_oz", "key": "lees_oz", "displayName": "Lev", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "lees_oz", "key": "lees_oz", "displayName": "Lev", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Operating System\r\n Name = Mac OS X\r\n Version = 10.9.2\r\n Architecture = 64bit\r\n # CPUs = 8\r\n Memory = 8.0GB\r\n\r\nNode.js\r\n Node.js Version = 0.10.20\r\n npm Version = 1.3.11\r\n\r\nTitanium CLI\r\n CLI Version = 3.3.0\r\n node-appc Version = 0.2.14", "comment": { "comments": [ { "id": "366544", "author": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hello , the new release of the titanium SDK(5.1.0) should fix the current bugs with the imageView. The image will now be resized to it's original size or to a specified one. Example code : \r\n\r\n{code} \r\n\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: 'white'\r\n});\r\nvar myTemplate = {\r\n\r\n properties: {\r\n height: 100,\r\n backgroundColor: 'red'\r\n },\r\n childTemplates: [{\r\n type: 'Ti.UI.ImageView',\r\n bindId: 'image',\r\n properties: {\r\n width: 100,\r\n height: 100,\r\n defaultImage: 'default_app_logo.png',\r\n backgroundColor: '#ccc'\r\n }\r\n }]\r\n};\r\nvar sections = [\r\n Ti.UI.createListSection({\r\n items: [{\r\n image: {\r\n image: 'http://cdn.slidesharecdn.com/profile-photo-appcelerator-48x48.jpg?cb=1416396285',\r\n backgroundColor: 'blue',\r\n width: Ti.UI.SIZE,\r\n height: 200\r\n }\r\n }]\r\n })\r\n];\r\n\r\nvar listView = Ti.UI.createListView({\r\n templates: {\r\n 'template': myTemplate\r\n },\r\n defaultItemTemplate: 'template',\r\n sections: sections,\r\n top: 20\r\n});\r\n\r\n\r\nwin.add(listView);\r\nwin.open();\r\n\r\n{code}", "updateAuthor": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-10-12T18:36:18.000+0000", "updated": "2015-10-12T18:36:18.000+0000" }, { "id": "367712", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "Verified as fixed, using example code provided by [~apetkov] ImageView can now be resized accordingly.\r\n\r\nTested on: iOS 9.1, 8.4 Devices. iOS 9.0 & 8.4 Simulators.\r\n\r\nMac OSX El Capitan 10.11 (15A284)\r\nStudio: 4.4.0.201510231805\r\nTi SDK: 5.1.0.v20151022152020 \r\nAppc NPM: 4.2.1-6\r\nAppc CLI: 5.1.0-38\r\nTi CLI: 5.0.4\r\nXcode 7.1(7B91b)\r\nNode v4.2.1\r\nproduction\r\n\r\n*Closing Ticket.*", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2015-10-23T23:42:49.000+0000", "updated": "2015-10-23T23:42:49.000+0000" }, { "id": "427286", "author": { "name": "zo0m", "key": "zo0m", "displayName": "Igor Kalashnikov", "active": true, "timeZone": "Europe/Helsinki" }, "body": "Hello,\r\nbug still exist on 6.1.2.GA on iOS\r\n\r\nSize of remote image after loading remains the same, I need to update ListItem to fix this, but if I add onLoad event to ImageView inside ListView I got error:\r\n\r\nListView:\r\n{code:xml}\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n{code}\r\n\r\nERROR:\r\n\r\n{noformat}\r\n[ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'.\r\n[ERROR] Reason:\r\n[ERROR] *** setObjectForKey: object cannot be nil (key: section)\r\n[ERROR] Stack trace:\r\n[ERROR] 0 CoreFoundation 0x0000000113dedd33 __exceptionPreprocess + 147\r\n[ERROR] 1 libobjc.A.dylib 0x000000011338521e objc_exception_throw + 48\r\n[ERROR] 2 CoreFoundation 0x0000000113d03d87 -[__NSDictionaryM setObject:forKey:] + 1047\r\n[ERROR] 3 GO-OD 0x000000010c24d35a -[TiUIListItemProxy overrideEventObject:forEvent:fromViewProxy:] + 362\r\n[ERROR] 4 GO-OD 0x000000010c00ba39 -[TiViewProxy fireEvent:withObject:propagate:reportSuccess:errorCode:message:] + 297\r\n[ERROR] 5 GO-OD 0x000000010c0ac12b -[TiProxy fireEvent:withObject:] + 139\r\n[ERROR] 6 GO-OD 0x000000010c0928e8 -[TiUIImageViewProxy propagateLoadEvent:] + 408\r\n[ERROR] 7 GO-OD 0x000000010c0956d2 -[TiUIImageView fireLoadEventWithState:] + 66\r\n[ERROR] 8 GO-OD 0x000000010c09638d -[TiUIImageView setURLImageOnUIThread:] + 1053\r\n[ERROR] 9 GO-OD 0x000000010c0991ea __40-[TiUIImageView imageLoadSuccess:image:]_block_invoke + 42\r\n[ERROR] 10 libdispatch.dylib 0x00000001181b1808 _dispatch_call_block_and_release + 12\r\n[ERROR] 11 libdispatch.dylib 0x00000001181d312e _dispatch_client_callout + 8\r\n[ERROR] 12 libdispatch.dylib 0x00000001181ba4fb _dispatch_main_queue_callback_4CF + 1054\r\n[ERROR] 13 CoreFoundation 0x0000000113db1e49 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9\r\n[ERROR] 14 CoreFoundation 0x0000000113d7737d __CFRunLoopRun + 2205\r\n[ERROR] 15 CoreFoundation 0x0000000113d76884 CFRunLoopRunSpecific + 420\r\n[ERROR] 16 GraphicsServices 0x0000000114d84a6f GSEventRunModal + 161\r\n[ERROR] 17 UIKit 0x000000010f4dac68 UIApplicationMain + 159\r\n[ERROR] 18 GO-OD 0x000000010bfc69b4 main + 100\r\n[ERROR] 19 libdyld.dylib 0x000000011821c68d start + 1\r\n[ERROR] 20 ??? 0x0000000000000001 0x0 + 1\r\n\r\n{noformat}\r\n\r\n\r\n", "updateAuthor": { "name": "zo0m", "key": "zo0m", "displayName": "Igor Kalashnikov", "active": true, "timeZone": "Europe/Helsinki" }, "created": "2017-08-27T06:17:26.000+0000", "updated": "2017-08-27T06:17:26.000+0000" }, { "id": "437870", "author": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "updateAuthor": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "created": "2018-05-23T09:06:46.000+0000", "updated": "2018-05-23T09:06:46.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }