This demo is only available for iOS8 and above systems.
This article uses Autolayout+storyboard to implement the pop-up window
First step, Storyboard create interface
1. Open Storyboard Drag a uiviewcontroller out and associated with class
2, drag out a uiview as a pop-up view of the container, the container to place the contents of the pop-up window, the container height according to the specific needs of the placement. The container is placed at the bottom
3, place a UIButton in the container view above the spacing of 0, and set the UIButton to black (for masking effect and click on the blank space to close the pop-up window)
4, constraints. The bottom container plays the left, right, bottom, and height constraints. UIButton play left, right, top, bottom constraints
Bottom container Constraint
UIButton constraints
5, constraints. Edit the bottom constraint of the bottom container to modify
Modify Container Bottom constraints
Modify Container Bottom constraints
Modify Container Bottom constraints
6, find the bottom of the container bottom constraints pull to the corresponding Uiviewcontroller
Cable
Second step, set mask and pop-up animation
1. Modify the transparency of the UIButton and set the background color of the Uiviewcontroller view to Transparent
Set transparency
2, the realization of the animation window, in the viewdidappear implementation, so that you can see the entire animation process
modifying constraints
3. Pop-up modal view
Modal view
Explanation of several attributes
explain the content to the blog Park do not Disturb is my gentle http://www.cnblogs.com/SenDylan/p/3953832.html
Providespresentationcontexttransitionstyle
Definespresentationcontext
Modalpresentationstyle
Part of the class read strange, not clear is not the reason for translation software.
4. Close the pop-up window
Close the pop-up window
Finally, demo GIF and demo.
Demo download
IOS uses modal views to implement bottom pop-up windows with black masks