[TIMOB-18183] iOS: Add property to disable "swipe to go back" gesture on navigation controller windows.
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2015-10-28T22:20:47.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | iOS |
| Labels | TCSupportTriage, ios, navigationWindow, tabgroup, window |
| Reporter | Ed |
| Assignee | Hans Knöchel |
| Created | 2014-08-16T00:40:48.000+0000 |
| Updated | 2017-03-22T22:38:37.000+0000 |
Description
With iOS 7, Apple introduced a new navigation gesture where you can swipe to the right from the left edge of the device to close a sub window within a navigation controller (NavigationWindow, TabGroup). This feature is enabled by default.
Currently, there is no way to disable this on Titanium except for a [workaround of using a custom leftNavButton](https://developer.appcelerator.com/question/158264/how-to-disable-back-swipe-gesture-on-ios-7). While this works, it is not ideal for all situations, and a property to toggle this feature would be better.
There's a solution posted on stackoverflow that could potentially be used to expose a new property on the Ti Window control:
[http://stackoverflow.com/questions/17209468/how-to-disable-back-swipe-gesture-in-uinavigationcontroller-on-ios-7]
In our particular case, we need to disable this gesture on some windows that have ScrollableViews within, as it can interfere with swiping for those views.
+1
Interestingly, this behaviour has just broken when using Appcelerator Studio. See this post in Q&A : [Swipe right from the edge to go back to the previous window doesn't work anymore in iOS (Using SDK 3.5.1.GA and 4.0.0.GA)](https://community.appcelerator.com/topic/581/swipe-right-from-the-edge-to-go-back-to-the-previous-window-doesn-t-work-anymore-in-ios-using-sdk-3-5-1-ga-and-4-0-0-ga/3) Test code works on all 3+ SDKs using Titanium Studio. Don't does not work when using Appc. Studio.
Is there any news about this? It would be nice to have ability to disable swipe-to-back gesture for specific window. Thank you
Using a custom backButton on the window will disable it.
Yes, I know, but it will be good to have this funcionality, if you want to use system back button.
We introduce the new property
swipeToClosein theTi.UI.WindowAPI to enable and disable the swipe-to-close gesture inside aTi.UI.iOS.NavigationWindowandTi.UI.Tab. This property istrueby default. PR: https://github.com/appcelerator/titanium_mobile/pull/7368Merged:
var nav = Ti.UI.iOS.createNavigationWindow({}); var win = Ti.UI.createWindow({ backgroundColor: 'white', title: 'Swipe to close test' }); nav.window = win; var btn1 = Ti.UI.createButton({ title: 'swipe enabled', top: 50 }); var btn2 = Ti.UI.createButton({ title: 'swipe not enabled', top: 150 }); btn1.addEventListener('click', function(){ nav.openWindow(Ti.UI.createWindow({ backgroundColor: '#ccc', title: 'swipe to close' })); }); btn2.addEventListener('click', function(){ nav.openWindow(Ti.UI.createWindow({ backgroundColor: '#ccc', title: 'cannot swipe to close', swipeToClose: false })); }); win.add(btn1); win.add(btn2); nav.open();Closing ticket as fixed.