{ "id": "113343", "key": "TIMOB-13666", "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": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2013-09-23T19:14:03.000+0000", "created": "2013-04-24T16:28:58.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-22T21:05:23.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": "h2. Description of the problem\r\nWhen switching between views using animate, the operation works (back and forth) only once.\r\n\r\nh2. Steps to reproduce\r\nUse the following code, switch to view 2, back to view 1, and again: it will only work once, then back to view1 it will not go anymore to view2.\r\n\r\n{code}\r\nfunction createView1() {\r\n\tvar view1 = Ti.UI.createView();\r\n\t\r\n\tvar btn1 = Ti.UI.createButton({\r\n\t\ttitle: 'Switch to view2'\r\n\t});\r\n\tbtn1.addEventListener('click', function() {\r\n\t\tvar view2 = createView2();\r\n\t\tview1.animate({view: view2, transition: Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT});\r\n\t});\r\n\tview1.add(btn1);\r\n\t\r\n\treturn view1; \r\n}\r\n\r\nfunction createView2() {\r\n\tvar view2 = Ti.UI.createView();\r\n\t\r\n\tvar btn2 = Ti.UI.createButton({\r\n\t\ttitle: 'Switch back to view1'\r\n\t});\r\n\tbtn2.addEventListener('click', function() {\r\n\t\tvar view1 = createView1();\r\n\t\tview2.animate({view: view1, transition: Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT});\r\n\t});\r\n\tview2.add(btn2);\r\n\t\r\n\treturn view2;\t\r\n}\r\n\r\nvar view1 = createView1();\r\nvar win = Ti.UI.createWindow();\r\nwin.add(view1);\r\nwin.open();\r\n{code}\r\n\r\nh2. Notes\r\nThe code sample above is re-creating the views all the times, as - according to the documentation - the view gets destroyed once the animation is over. In fact, if the views are not re-created, the app will crash trying to switch back.", "attachment": [], "flagged": false, "summary": "iOS: switching between views with animate fails after the first attempt", "creator": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "environment": "iOS 6.1\r\nSDK 3.0.2\r\nSDK 3.1.0", "comment": { "comments": [ { "id": "272525", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Transition animation on views are to transition subviews of a View (In this case the window). Use this code instead\n{code}\nfunction createView1() {\n var view1 = Ti.UI.createView({backgroundColor:'red'});\n \n var btn1 = Ti.UI.createButton({\n title: 'Switch to view2'\n });\n btn1.addEventListener('click', function() {\n win.animate({view: view2, transition: Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT});\n });\n view1.add(btn1);\n \n return view1; \n}\n \nfunction createView2() {\n var view2 = Ti.UI.createView();\n \n var btn2 = Ti.UI.createButton({\n title: 'Switch back to view1'\n });\n btn2.addEventListener('click', function() {\n win.animate({view: view1, transition: Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT});\n });\n view2.add(btn2);\n \n return view2; \n}\n \nvar view1 = createView1();\nvar view2 = createView2();\nvar win = Ti.UI.createWindow();\nwin.add(view1);\nwin.open();\n{code}", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-09-23T19:13:43.000+0000", "updated": "2013-09-23T19:13:43.000+0000" }, { "id": "414955", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid with reference to the above comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-22T21:05:23.000+0000", "updated": "2017-03-22T21:05:23.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }