gestures and done possible fix

This commit is contained in:
Pfeil, Scott Robert 2020-06-25 10:18:42 -04:00
parent ba795b6d35
commit 9881feb39b
2 changed files with 13 additions and 2 deletions

View File

@ -38,6 +38,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
splitViewController.delegate = self
splitViewController.preferredDisplayMode = .allVisible
let gr = UILongPressGestureRecognizer(target: self, action: #selector(pasteAndGo))
splitViewController.view.addGestureRecognizer(gr)
NotificationCenter.default.addObserver(forName: UIViewController.showDetailTargetDidChangeNotification, object: splitViewController, queue: nil) { [weak self] (notification) in
if let strongSelf = self, let svc = notification.object as? UISplitViewController {
if svc.isCollapsed {
@ -51,6 +54,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
return true
}
@objc func pasteAndGo() {
(dvc as? DetailViewController)?.textView.text = UIPasteboard.general.string
(dvc as? DetailViewController)?.play()
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
@ -93,4 +101,3 @@ extension AppDelegate: UINavigationControllerDelegate {
}
}
}

View File

@ -67,7 +67,11 @@ class DetailViewController: UIViewController {
let loadObject = MVMCoreLoadObject(pageJSON: page, modulesJSON: jsonObject.optionalDictionaryForKey(KeyModuleMap), requestParameters: nil, dataForPage: nil, delegateObject: nil),
viewController.shouldFinishProcessingLoad(loadObject, error: &errorObject!) {
let navigation = UINavigationController(rootViewController: viewController)
viewController.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(close))
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) {
viewController.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(self.close))
}
let gr = UILongPressGestureRecognizer(target: self, action: #selector(DetailViewController.close))
viewController.view.addGestureRecognizer(gr)
MVMCoreNavigationHandler.shared()?.present(navigation, animated: true)
} else if let errorObject = errorObject {
let error = NSError(domain: ErrorDomainNative, code: ErrorCode.initViewController.rawValue, userInfo: [NSLocalizedDescriptionKey: errorObject.messageToLog ?? errorObject.messageToDisplay!])