iOS基于UIPresentationController的封装
效果图
简单介绍
基于UIPresentationController
的封装,支持多种转场效果,还可轻松自定义转场动画。
使用方法:
- 需要
present
的ViewController
遵守PresentedViewType
协议即可,代码如下:
class AlertViewController: UIViewController, PresentedViewType {
var component: PresentedViewComponent
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
component = PresentedViewComponent(contentSize: CGSize(width: 260, height: 240))
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
required init?(coder aDecoder: NSCoder) {
component = PresentedViewComponent(contentSize: CGSize(width: 260, height: 240))
super.init(coder: aDecoder)
}
}
- 要自定义转场效果及其他,只需要设置
component
即可:
....
let alertVC = getAlertVC()
var component = PresentedViewComponent(contentSize: CGSize(width: 260, height: 240))
component.destination = .center
component.presentTransitionType = .custom(animation: CrossZoomAnimation(scale: 0.01, options: .spring(duration: 0.5, delay: 0, damping: 0.4, velocity: 10), origin: .center))
component.dismissTransitionType = .crossZoom
component.keyboardTranslationType = .compressInputView
component.keyboardPadding = 60
alertVC.component = component
presentViewController(alertVC)
....
更具体的用法请下载 Demo查看。
Howdy, I believe your website may be having browser compatibility issues. Nicki Ethelbert Ajay
I think this is a real great blog post. Really thank you! Really Great. Lindsy Ulrich Audrey
Good article. I am dealing with many of these issues as well.. Ginni Kimball Bolger
Some truly good articles on this internet site , appreciate it for contribution. Amil Estevan Danit
Im obliged for the blog article. Really looking forward to read more. Keep writing. Pepita Cobb Hibbert
Great post! We are linking to this great content on our website. Raina Earlie Benoite
Its wonderful as your other content :D, regards for posting. Sonny Titus Kerry
These are actually great ideas in concerning blogging. Addie Upton Alecia
Every weekend i used to pay a quick visit this site, as i wish for enjoyment, since this this website conations truly fastidious funny data too. Phaidra Stewart Fremont
I like this site because so much useful stuff on here : D. Rosemaria Cord Archibald
Hey! I understand this is kind of off-topic but I had to ask. Georgina Donall Hapte
Every weekend i used to visit this web page, because i want enjoyment, as this this site conations in fact fastidious funny information too. Ninette Gottfried Desdamonna
I have read so many posts about the blogger lovers but this article is in fact a good article, keep it up. Vivie Romeo Olcott
I think this is one of the so much important information for me. Brinna Virgil Kyrstin
This helps validate your skills and can give you that extra confidence boost when playing against your opponents. Cahra Wendell Toh
Excellent post. I am facing some of these issues as well.. Maitilde Forrester Rochella
There is perceptibly a bunch to know about this. I think you made some good points in features also. Ronny Errick Perni
This is one awesome article. Really thank you! Fantastic. Melanie Finn Mosier
I am sure this article has touched all the internet viewers, its really really fastidious post on building up new web site. Amalita Carleton Polly
I go to see everyday some sites and sites to read content, except this weblog presents quality based articles. Josy Erin Nahamas
You completed some fine points there. I did a search on the subject and found nearly all folks will have the same opinion with your blog. Kristine Ramsey Barb
I have read so many articles on the topic of the blogger lovers however this post is actually a good piece of writing, keep it up. Dion Ernesto Dietrich
I wanted to thank you for this very good read!! I certainly enjoyed every little bit of it. Jenda Gannie Sanfo