YYPopView
自定义转场动画来显示PopView
介绍
这种效果类似微信右上角的弹窗,但不同的是,PopView
添加了转场动画,这使得效果看起来更酷。
微信的样子
我的目前看起来就是这个样子
用法
Cocoapod
pod 'YYPopView', '~> 0.0.1'
手动
将Resource
文件夹拖拽到项目中
具体使用方法
-
选择弹出视图的显示位置
左,中,右
@IBAction func didClickedLeftButton() { modalPopView(PopViewType.Left) } @IBAction func didClickedCenterButton() { modalPopView(PopViewType.Center) } @IBAction func didClickeRightButton() { modalPopView(PopViewType.Right) }
-
遵守popView的两个代理方法
func modalPopView(type:PopViewType){ let popVc = PopViewController() popVc.popType = type popVc.transitioningDelegate = animationDelegate popVc.modalPresentationStyle = UIModalPresentationStyle.Custom popVc.selectDelegate = self animationDelegate.popViewType = type presentViewController(popVc, animated: true, completion: nil) }
-
代理方法实现
extension ViewController:DidSelectPopViewCellDelegate{ func didSelectRowAtIndexPath(indexPath: NSIndexPath) { print("点击了第\(indexPath.row)个") } }
ViewController
具体实例请下载项目,参照声明
- 已适配3.5英寸~5.5英寸。
- iOS 8以上可用,iOS 8以下未测试。
- 有问题请随时issue或者通过邮箱heisenbean.me@gmail.com联系我。