diff --git a/JSONCreator_iOS/JSONCreator/AppDelegate.swift b/JSONCreator_iOS/JSONCreator/AppDelegate.swift index d9fe595..45443d9 100644 --- a/JSONCreator_iOS/JSONCreator/AppDelegate.swift +++ b/JSONCreator_iOS/JSONCreator/AppDelegate.swift @@ -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 { @@ -50,6 +53,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. @@ -93,4 +101,3 @@ extension AppDelegate: UINavigationControllerDelegate { } } } - diff --git a/JSONCreator_iOS/JSONCreator/DetailViewController.swift b/JSONCreator_iOS/JSONCreator/DetailViewController.swift index d4f6b8e..c64c967 100644 --- a/JSONCreator_iOS/JSONCreator/DetailViewController.swift +++ b/JSONCreator_iOS/JSONCreator/DetailViewController.swift @@ -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!])