iOS 视图切换:DAExpandAnimation
jopen
9年前
DAExpandAnimation 是一个自定义的模式切换,提供一个有拉伸效果的控件。
Usage
Try the example project!
Have your view controller conform to UIViewControllerTransitioningDelegate. Optionally set thecollapsedViewFrame, theexpandedViewFrameand theanimationDuration.
private let animationController = DAExpandAnimation() override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if let toViewController = segue.destinationViewController as? UIViewController, selectedCell = sender as? UITableViewCell { toViewController.transitioningDelegate = self toViewController.modalPresentationStyle = .Custom toViewController.view.backgroundColor = selectedCell.backgroundColor animationController.collapsedViewFrame = { return selectedCell.frame } animationController.animationDuration = Constants.SomeAnimationDuration if let indexPath = tableView.indexPathForCell(selectedCell) { tableView.deselectRowAtIndexPath(indexPath, animated: false) } } } func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? { return animationController } func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { return animationController }截图