Swift Modal View Controller with transparent background [duplicate]

You can do it like this: In your main view controller: func showModal() { let modalViewController = ModalViewController() modalViewController.modalPresentationStyle = .overCurrentContext presentViewController(modalViewController, animated: true, completion: nil) } In your modal view controller: class ModalViewController: UIViewController { override func viewDidLoad() { view.backgroundColor = UIColor.clearColor() view.opaque = false } } If you are working with a storyboard: … Read more

Changing VC issue in Swift. How to pass data between views in tab bar controller?

From your Storyboard diagram, it is clear that you have created a segue from each button in your “tab bar” to another view controller. Except for the unwind segue, segues always create a new instance of the view controller they are switching to. So if you use your setup to switch from view controller 1 … Read more

UIModalTransitionStylePartialCurl doesn’t get back to previous state. (Not dismissing)

Here is the link to Apple site for the Modal View Controllers Basically, you need to setup delegate, etc. And call dismissModalViewControllerAnimated: method from your viewcontroller A. Let me know if you need further help. Edit per MiiChiel: In BController.h file, add this: @protocol BControllerDelegate <NSObject> -(void)dismissMe; @end @interface BController : UIViewController //… @property (assign) … Read more

iOS: Modal ViewController with transparent background

For those trying to get this to work in iOS 8, the “Apple-approved” way to display a transparent modal view controller is by setting modalPresentationStyle on the presented controller to UIModalPresentationOverCurrentContext. This can be done in code, or by setting the properties of the segue in the storyboard. From the UIViewController documentation: UIModalPresentationOverCurrentContext A presentation … Read more

dismissModalViewController AND pass data back

You need to use delegate protocols… Here’s how to do it: Declare a protocol in your secondViewController’s header file. It should look like this: #import <UIKit/UIKit.h> @protocol SecondDelegate <NSObject> -(void)secondViewControllerDismissed:(NSString *)stringForFirst @end @interface SecondViewController : UIViewController { id myDelegate; } @property (nonatomic, assign) id<SecondDelegate> myDelegate; Don’t forget to synthesize the myDelegate in your implementation (SecondViewController.m) … Read more

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)