自定义转场动画展现PopView
这种效果类似微信右上角的弹窗,但不同的是,PopView
加了转场动画,这样看上去更酷一点.
pod 'YYPopView', '~> 0.0.1'
将Resource
文件夹拖入到工程中
-
选择popView的展现位置
左,中,右
@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.5inch~5.5inch.
- iOS8以上可用,iOS8以下没测试过.
- 有问题随时issue或者邮箱heisenbean.me@gmail联系我.