I want to achieve following custom view over UIViewController
. What is the best way to acheive it rather then using addSubview I want to use some thing better.
Use a Modal presentation with OverFullScreen
mode. Set the background of the ViewController's view to transparent and place your custom view in the center of it.
Easiest would be to use storyboards. Create a view controller with your custom view in the center. Otherwise, you need to call view.addSubView(..)
to place your custom view on the center and create the constraints accordingly.
To present this view controller you can create a segue or by code presentViewController(...)
. Don't forget to set the modalPresentationStyle
to OverFullScreen
.
No library required.