Add custom tap recognizer to text view

Stock gesture doesn't work on subview.
This commit is contained in:
Davide De Rosa 2019-04-29 17:59:01 +02:00
parent 16b8a44a30
commit 6ecf859a5e
1 changed files with 9 additions and 2 deletions

View File

@ -52,6 +52,9 @@ class DebugLogViewController: UIViewController {
title = L10n.Service.Cells.DebugLog.caption
textLog?.contentInsetAdjustmentBehavior = .never
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(toggleBars))
textLog?.addGestureRecognizer(tapGestureRecognizer)
NotificationCenter.default.addObserver(self, selector: #selector(vpnDidPrepare), name: .VPNDidPrepare, object: nil)
if vpn.isPrepared {
startRefreshingLog()
@ -62,18 +65,22 @@ class DebugLogViewController: UIViewController {
super.viewWillAppear(animated)
navigationController?.isToolbarHidden = false
navigationController?.hidesBarsOnTap = true
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
navigationController?.isToolbarHidden = true
navigationController?.hidesBarsOnTap = false
}
// MARK: Actions
@objc private func toggleBars() {
let isHidden = navigationController?.isToolbarHidden ?? true
navigationController?.setNavigationBarHidden(!isHidden, animated: true)
navigationController?.setToolbarHidden(!isHidden, animated: true)
}
@IBAction private func share(_ sender: Any?) {
guard let raw = textLog?.text, !raw.isEmpty else {
let alert = Macros.alert(title, L10n.DebugLog.Alerts.EmptyLog.message)