iOS 視圖切換:DAExpandAnimation
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 }截圖
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!