{ "id": "61576", "key": "TIMOB-944", "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": [ { "id": "11224", "name": "Release 1.4.0", "archived": true, "released": true, "releaseDate": "2010-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:54:44.000+0000", "created": "2011-04-15T02:39:49.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:54:44.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": "{html}
if you try to save a reference to the popover from the visible\nevent and then use it later, it crashes. here's the code:
\nvar masterWindow = Ti.UI.createWindow({
\nbackgroundColor: '#fdf5e5',\nbarColor: '#ec4930'
\n
\n});
\nvar masterNavigationGroup =\nTi.UI.iPhone.createNavigationGroup({
\nwindow: masterWindow });
var b = Ti.UI.createButton({
\ntitle:'Search',\nheight:100,\nwidth:100
\n
\n}); b.addEventListener('click', function()
\n{
\nTi.App.fireEvent('openMasterView');
\n
\n});
\nvar detailWindow = Ti.UI.createWindow({
\nbackgroundColor: '#f7f0e3', barColor: '#ec4930', rightNavButton: b\n});
var detailNavigationGroup =\nTi.UI.iPhone.createNavigationGroup({
\nwindow: detailWindow });
var splitWindow = Ti.UI.iPad.createSplitWindow({
\ndetailView: detailNavigationGroup,\nmasterView: masterNavigationGroup
\n
\n});
\nvar masterPopover = null;
\nvar masterView = null;
\nsplitWindow.addEventListener('visible', function(e)
\n{
\nmasterPopover = e.popover;\nmasterView = e.button\nif (e.view == 'detail') \n{\n e.button.title = \"foo\";\n detailWindow.leftNavButton = e.button; \n\n}\n\nelse if (e.view == 'master') \n{\n detailWindow.leftNavButton = null;
\n
\n} });
\nTi.App.addEventListener(\"openMasterView\", function(d)
\n{
\nTi.API.info('in openMasterView pop ' + masterPopover)\nif (masterPopover != null)\n{\n masterPopover.show({view:masterView}); \n}
\n
\n});
splitWindow.open();
The biggest issue here is that I have no idea what the user is\ntrying to accomplish. Why would you show a popover of a button? The\nwording seems to indicate that they want to show a popover of the\nmaster view, but why would you ever do that?
\nThere is an additional problem that the masterView variable\nappears to be incorrectly set at certain times as far as the\ncontext for the app event listener is concerned. Regardless, there\nare still problems with popovers.
\nHere is some slightly modified code, which crashes in a\ndifferent (but vastly more appropriate) way:
\n\nvar masterWindow = Ti.UI.createWindow({\n backgroundColor: 'red',\n barColor: '#ec4930'\n});\n\nvar masterPopover = null;\nvar masterView = null;\nvar b = Ti.UI.createButton({\n title:'Search',\n height:100,\n width:100\n}); \nb.addEventListener('click', function()\n{\n Ti.API.info('in openMasterView pop ' + masterPopover);\n Ti.API.info('Master view: '+masterView);\n if (masterPopover != null)\n {\n masterPopover.show({view:masterView, \n rect:{x:100,y:100,width:100,height:300}}); \n }\n});\n\nvar detailWindow = Ti.UI.createWindow({\n backgroundColor: 'blue', \n barColor: '#ec4930', \n rightNavButton: b \n});\n\nvar masterNavigationGroup = Ti.UI.iPhone.createNavigationGroup({\n window: masterWindow\n});\nvar detailNavigationGroup = Ti.UI.iPhone.createNavigationGroup({\n window:detailWindow\n});\n\nvar splitWindow = Ti.UI.iPad.createSplitWindow({\n detailView: detailNavigationGroup,\n masterView: masterNavigationGroup\n});\n\nsplitWindow.addEventListener('visible', function(e) {\n Ti.API.log(e);\n masterPopover = e.popover;\n masterView = e.button;\n if (e.view == 'detail') \n {\n e.button.title = \"foo\";\n detailWindow.leftNavButton = e.button; \n }\n else if (e.view == 'master') \n {\n detailWindow.leftNavButton = null;\n } \n Ti.API.log('Master view:'+masterView);\n});\n\nsplitWindow.open();
\n
\nLooking into resolving this now.
They are trying to set the value of masterPopover in order to\nuse it later in the app. Seems valid to me.
Yeah, that comment was written before I took a look through some\nmore of the presentation code. There is still some kind of very\nstrange issue with setting masterView = e.button, however, because\nin the app event listener it wasn't the correct value (although it\nwas the right value in the context of the function which set\nit).
(from [7fc6a66f81548c8535f270bed0106464fc0cfc65])\n[#944\nstate:open] Fixes to split window buttons. Necessary for upcoming\nchanges to how popovers display. \nhttp://github.com/appcelerator/titanium_mobile/commit/7fc6a66f81548...
(from [c28c79c40727235b3481a0d042299b8a408fd22a])\nCloses #944: Removed access to the splitview's builtin\npopover. See the ticket for why. \nhttp://github.com/appcelerator/titanium_mobile/commit/c28c79c407272...
This was a case of burning the village to save it. We shouldn't\nallow access to the popover that's managed by the split view,\nbecause certain magic happens with it - if it's messed with in any\nway, that magic might not happen (or could appear very odd).\nBesides, the popover doesn't have anything innate about it beyond\nbeing used for this special system: It doesn't automatically hold\nthe master view, for example.
\nIf it's absolutely necessary to display the master view in a\nnon-convential way via popover, you should make your own popover\nand manage it yourself, to display the master view when\nrequired.
Regarding removing access to the Popover in a Splitview.
\nThere is one reason why one would need access to it ... to close\nit when an event is fired.
\nIf you look at the standard Mail app, when an email is selected\nfrom the splitview popover, the app automatically closes the\npopover and shows the detail window.
\nCurrently in the visible event, having the instance would allow\nthe app to close the popover. With out that access to the object,\nthere is no apparent way to close the default split view\nPopover.
\nIf there is, please post response.
\nThanks
\nTim
Looking through the code, there is not currently a way exposed\nto close an open split view popover. I don't mind the ability to\nclose the split view popover, but I'd much rather it be\nfunctionality explicitly added to split view (IE,\nsplitView.closeMainViewPopover() ) rather than restore the previous\nhack. The previous hack was very error prone and would have caused\na great many problems going forward.
So, can we get such a function into the road map for 1.5 or a\nlater release?
Hi,
\nWas a solution ever put in place for this functionality? It's\ncrucial that we are able to dismiss the popover programmatically,\nnot just from a UX point of view but also because it can cause\ncrashes. For example, if one attempts to close a split window while\nthe popover is still visible, the following crash occurs:
\n\n2011-03-06 13:18:52.817 S4CiPad[91506:207] *** Terminating app due to uncaught exception 'NSGenericException', reason: '-[UIPopoverController dealloc] reached while popover is still visible.'
\n
\nThanks.