Juhi Danak
Juhi Danak

Reputation: 51

how to open another view on same screen by clicking button in swift

I want to open a view on an another view by clicking button. I am attaching snap of it, for better understanding.

This image is my desired output

This image is my base view, which you can see in my desired one at the back side, with less opacity

If anybody has idea, Please help me for this..

Upvotes: 0

Views: 647

Answers (1)

GayashanK
GayashanK

Reputation: 1215

You can use this library (MZFormSheetPresentationController) to create the Alert like views with Images,Buttons and lots of functions. You can design viewController as you expected.

func formSheetControllerWithNavigationController() -> UINavigationController {
                return self.storyboard!.instantiateViewController(withIdentifier: "formSheetController") as! UINavigationController
}

func passDataToViewControllerAction() {

            let navigationController = self.formSheetControllerWithNavigationController()
            let formSheetController = MZFormSheetPresentationViewController(contentViewController: navigationController)
            formSheetController.presentationController?.isTransparentTouchEnabled = false
            formSheetController.presentationController?.shouldCenterVertically = true
            formSheetController.presentationController?.shouldCenterHorizontally = true
            formSheetController.presentationController?.shouldDismissOnBackgroundViewTap = true

            let yourViewController = navigationController.viewControllers.first as! EventDisplayViewController

            yourViewController.delegate = self



            self.present(formSheetController, animated: true, completion: nil)
}

Upvotes: 1

Related Questions