{ "id": "120209", "key": "TIMOB-15284", "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": [ { "id": "15699", "description": "2013 Sprint 21", "name": "2013 Sprint 21", "archived": true, "released": true, "releaseDate": "2013-10-18" }, { "id": "15700", "description": "2013 Sprint 21 API", "name": "2013 Sprint 21 API", "archived": true, "released": true, "releaseDate": "2013-10-18" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-10-08T21:49:19.000+0000", "created": "2013-09-19T18:17:30.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "ios7", "module_window", "qe-testadded", "triage" ], "versions": [], "issuelinks": [], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2014-01-17T20:14:27.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": "h1. The Problem\r\nRight now, Ti.UI.Window's statusBarStyle can only be specified during creation. Once the window is open, you can't change it. This prevents simple use cases like night and day reading modes for an app (black background, white background).\r\n\r\nh2. The Solution\r\nExpose setStatusBarStyle on Ti.UI.Window, which calls TiRootViewController's updateStatusBar, and change updateStatusBar to use the main thread.\r\nhttps://github.com/appcelerator/titanium_mobile/pull/4709/files\r\n\r\nh2. Example\r\n{code}var isDayMode = true,\r\n\tios = Ti.Platform.name === 'iPhone OS',\r\n\tiosFlat = ios && +Ti.Platform.version >= 7,\r\n\twin = Ti.UI.createWindow({\r\n\t\tbackgroundColor: '#fff'\r\n\t}),\r\n\tlabel = Ti.UI.createLabel({\r\n\t\ttext: 'Day Mode', textAlign: 'center',\r\n\t\tcolor: '#000', font: { fontSize: 30 },\r\n\t\ttop: iosFlat ? 60 : 30, bottom: 0\r\n\t}),\r\n\tbutton = Ti.UI.createButton({\r\n\t\ttitle: 'Switch',\r\n\t\tcolor: '#000',\r\n\t\ttop: iosFlat ? 30 : 0, height: 30\r\n\t});\r\nbutton.addEventListener('click', function() {\r\n\tisDayMode = !isDayMode;\r\n\tif (isDayMode) {\r\n\t\tios && (win.statusBarStyle = Ti.UI.iPhone.StatusBar.GRAY);\r\n\t\twin.backgroundColor = '#ccc';\r\n\t\tlabel.color = button.color = '#000';\r\n\t\tlabel.text = 'Day Mode';\r\n\t}\r\n\telse {\r\n\t\tios && (win.statusBarStyle = Ti.UI.iPhone.StatusBar.TRANSLUCENT_BLACK);\r\n\t\twin.backgroundColor = '#444';\r\n\t\tlabel.color = button.color = '#fff';\r\n\t\tlabel.text = 'Night Mode';\r\n\t}\r\n});\r\nwin.add(label);\r\nwin.add(button);\r\nwin.open();{code}", "attachment": [], "flagged": false, "summary": "iOS7: Support Programmatically Changing the Status Bar Style", "creator": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "environment": null, "comment": { "comments": [ { "id": "274264", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "PR https://github.com/appcelerator/titanium_mobile/pull/4709 merged", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-10-08T21:49:19.000+0000", "updated": "2013-10-08T21:49:19.000+0000" }, { "id": "274571", "author": { "name": "pmishra", "key": "pmishra", "displayName": "Paras Mishra", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Verified fixed on:\r\nDevice : iPhone 4S , iOS version : 7 \r\nSDK: 3.2.0.v20131008154043\r\nCLI version : 3.2.0\r\nOS : MAC OSX 10.8.4\r\nAlloy : 1.2.2\r\nAppcelerator Studio, build: 3.2.0.201310092427\r\nXCode : 5", "updateAuthor": { "name": "pmishra", "key": "pmishra", "displayName": "Paras Mishra", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-10-10T09:28:47.000+0000", "updated": "2013-10-10T09:28:47.000+0000" }, { "id": "288644", "author": { "name": "allenhartwig", "key": "allenhartwig", "displayName": "Allen Hartwig", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This does not work for a Window within a NavigationWindow on 3.2.0GA. The Navigation window will change, but the Window within will not change unless a modal window is displayed then closed. (there may be other events that force a UI update as well, but this is the only I've found.)\r\n\r\nindex.xml\r\n{code:xml}\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nindex.js\r\n{code:Javascript}\r\n$.nav.open();\r\n\r\nfunction show(){\r\n\tAlloy.createController('modal').getView().open({modal: true});\r\n}\r\n\r\n//change the status bar style 3 seconds after launching\r\nsetTimeout(function(){\r\n\t$.nav.setStatusBarStyle(Ti.UI.iPhone.StatusBar.LIGHT_CONTENT);\r\n\t$.window.setStatusBarStyle(Ti.UI.iPhone.StatusBar.LIGHT_CONTENT);\r\n\t$.window.setBackgroundColor(\"#555\");\r\n}, 3000); \r\n{code}\r\n\r\nmodal.xml\r\n{code:xml}\r\n\r\n\t\r\n\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nmodal.js\r\n{code:JavaScript}\r\nfunction close(){\r\n\t$.window.close();\r\n}\r\n{code}\r\n", "updateAuthor": { "name": "allenhartwig", "key": "allenhartwig", "displayName": "Allen Hartwig", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-17T20:14:27.000+0000", "updated": "2014-01-17T20:14:27.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }