gpt4 book ai didi

ios - 从 UITableView 动画 UITableViewCell?

转载 作者:行者123 更新时间:2023-11-29 02:44:49 25 4
gpt4 key购买 nike

是否可以为 UITableViewCell 设置动画,使其在被选中时看起来像是从表格中出来、缩小并消失在导航栏上的按钮中?

我觉得这是可行的,但我不确定从哪里开始。

如有任何指点,我们将不胜感激。

最佳答案

假设您的 View Controller 位于 UINavigationController 中,则可以使用 UINavigationControllerDelegate

  1. 将您的 View Controller 设置为导航 Controller 的委托(delegate) (self.navigationcontroller.delegate = self)
  2. 实现方法 -navigationController:animationControllerForOperation:fromViewController:toViewController: 并返回一个符合 UIViewControllerAnimatedTransitioning 协议(protocol)的对象。
  3. 实现该协议(protocol)的方法。在方法 -animateTransition: 中,您将被传递一个符合 UIViewControllerContextTransitioning 的参数。该对象将允许您获得对要转换到的 View Controller 的引用。
  4. 用同样的方法,您将制作动画。这将是习俗。您将想要拍摄要转换到的 View 的快照。此时的问题是确定单元格的位置,创建包含单元格图像的 View ,并执行必要的动画和转换。

与大多数自定义动画一样,这不是一件微不足道的事情,但这应该会让您走上正确的道路。希望这会有所帮助。

关于ios - 从 UITableView 动画 UITableViewCell?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25276417/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com