0

this

I need to present a view like this, without full-screen, like a popover or popup. I don't know if this presentation style has a name. Does someone know a way to do this? Or someone can tell me where I can found this? Thanks to all.

Fabian
  • 5,040
  • 2
  • 23
  • 35
  • You mean something like this? https://stackoverflow.com/questions/37967555/how-can-i-mimic-the-bottom-sheet-from-the-maps-app – Eddwin Paz Mar 25 '19 at 00:46
  • Not really but the tutorial works very well for me, I change the way I want to present and I made like that, so thanks so much! I really appreciate it – Jesus Barragan Mar 26 '19 at 21:28

1 Answers1

0

Open translucent modal controller :

class ViewController: UIViewController {

   func openTranslucentController() -> ModalController {

        let storyboard: UIStoryboard = UIStoryboard(name: "Controller", bundle: nil)
        let controller: ModalController = storyboard.instantiateViewController(withIdentifier: "ControllerIdentifier") as! ModalController

        controller.view.backgroundColor = UIColor.black.withAlphaComponent(0.5)
        controller.modalPresentationStyle = .overCurrentContext
        self.present(controller, animated: true, completion: nil)
    }
}

Now, you can design it in the required way.

sinner
  • 483
  • 3
  • 14
  • Thanks but works like other way that I used before, the reason I post my question, it`s because a 3 weeks ago, looking for a way to show controllers like pop up, I read a answer with code that makes just the same view controller like facebook, with the gray item, so if I slide down the view controller, it dismiss. And I lost that answer to make it again – Jesus Barragan Mar 24 '19 at 20:34
  • You can add 'UISwipeGestureRecognizer' to it and recognise for type 'UISwipeGestureRecognizerDirection.Down' to dismiss it on swipe down, or 'UIPanGestureRecognizer' to gently dismiss it on slide. – sinner Mar 24 '19 at 20:39