In iOS, how to drag down to dismiss a modal?

I just created a tutorial for interactively dragging down a modal to dismiss it. http://www.thorntech.com/2016/02/ios-tutorial-close-modal-dragging/ I found this topic to be confusing at first, so the tutorial builds this out step-by-step. If you just want to run the code yourself, this is the repo: https://github.com/ThornTechPublic/InteractiveModal This is the approach I used: View Controller You override … Read more

Swift programmatically navigate to another view controller/scene

Swift 5 The default modal presentation style is a card. This shows the previous view controller at the top and allows the user to swipe away the presented view controller. To retain the old style you need to modify the view controller you will be presenting like this: newViewController.modalPresentationStyle = .fullScreen This is the same … Read more

Only ONE VIEW landscape mode

Swift AppDelegate.swift internal var shouldRotate = false func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { return shouldRotate ? .allButUpsideDown : .portrait } Your landscape view controller let appDelegate = UIApplication.shared.delegate as! AppDelegate appDelegate.shouldRotate = true // or false to disable rotation Objective-C AppDelegate.h @property (assign, nonatomic) BOOL shouldRotate; AppDelegate.m – (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow … Read more

How to Navigate from one View Controller to another using Swift

Create a swift file (SecondViewController.swift) for the second view controller and in the appropriate function type this: let secondViewController = self.storyboard.instantiateViewControllerWithIdentifier(“SecondViewController”) as SecondViewController self.navigationController.pushViewController(secondViewController, animated: true) Swift 2+ let mapViewControllerObj = self.storyboard?.instantiateViewControllerWithIdentifier(“MapViewControllerIdentifier”) as? MapViewController self.navigationController?.pushViewController(mapViewControllerObj!, animated: true) Swift 4 let vc = UIStoryboard.init(name: “Main”, bundle: Bundle.main).instantiateViewController(withIdentifier: “IKDetailVC”) as? IKDetailVC self.navigationController?.pushViewController(vc!, animated: true)

Presenting modal in iOS 13 fullscreen

With iOS 13, as stated in the Platforms State of the Union during the WWDC 2019, Apple introduced a new default card presentation. In order to force the fullscreen you have to specify it explicitly with: let vc = UIViewController() vc.modalPresentationStyle = .fullScreen //or .overFullScreen for transparency self.present(vc, animated: true, completion: nil)

tech