Gesture control without NavigationView
Is there a way to retain the functionality of gesture navigation, eg. swiping right to go back one page, when navigation_bar_hidden is set to true? I was exploring the use of @mikael 's gestures module, but I'm not sure I can apply gestures on anything other than ui subclasses if I'm correct. If anyone could shed light on this, I would be grateful.
mikael last edited by
@Veorra, gestures module uses iOS gestures, which work on any ui view, not just custom subclasses.
That said, I have used NavigationView with the title bar hidden and the swipe still worked, but I had to do a little bit extra to hide the title bar:
n = ui.NavigationView(m, navigation_bar_hidden=False, tint_color='white') n.objc_instance.navigationController().navigationBar().hidden = True n.present('fullscreen', hide_title_bar=True)
@mikael thank you, that's exactly what I was looking for. For future reference, how can I access documentation for classes that aren't indexed on the pythonista page, for instance 'navigationController'. It seems this workaround requires access to the class but I wouldn't have known it existed were it not for your reply.
Thanks a bunch again!
mikael last edited by
@Veorra, if I remember right, I noticed that the swipe was not working and googled the issue, coming up with a stack answer related to the same ObjC object.
I guess one key thing to realize is that most of the view are wrappers around the UIKit views, which can be accessed with
view.objc_instance, after which you can
dir(...)the available attributes and methods, and look at the related Apple docs.
Digging through UIKit with Objc utils has indeed turned out to be very useful.
Although I've stumbled upon a new issue associated with hiding the title bar. It seems if I present a view with the style 'sheet' and dismiss it via swipe, I cannot reopen it without the Exception that the view is already being presented. This does not seem to happen if I dismiss it with the close button on the title bar. Currently looking into this, but if you've encountered this before and care to share a workaround, I'd appreciate it.
stephen last edited by stephen
possibly make a call to method in your main View class that if you make swipe gester you call
self.close()(or objc equivalent lol) this is all the titlebar button does if im correct? should fix this issue and relrive you of titlebar