gpt4 book ai didi

macos - cocoa:如何实现表格动画?

转载 作者:行者123 更新时间:2023-12-03 17:41:44 26 4
gpt4 key购买 nike

我很好奇如何实现以下应用程序动画:enter image description here

点击 Alcides 后,应用程序将逐渐在右侧显示一个新 View ,左侧表格宽度将为原来的 1/2。
enter image description here

如果我想实现,我该怎么做?我应该使用什么数据结构和动画?

最佳答案

大多数自定义动画的答案是考虑您想要做什么并执行它。陈词滥调但却是事实。

  1. 以动画速度X将tableview的宽度切成两半

  2. 以动画速度 X 从右侧移动 RH 详细信息表

您需要将场景的 ViewController 作为这对表的容器。但是 TableView 可能有自己的 View Controller ,容器管理器应该对其保持强引用。

ManagerViewController -> UIView -> PeopleTableView -> PeopleTableViewController
-> DetailTableView -> DetailTableViewController

所以在代码中...

detailTableView.frame = Frame_with_x_aligned_to_RH_edge_of_screen;

[UIView animateWithDuration:X
animations:^{
peopleTableView.frame = Frame_with_half_its_fully_expanded_width;
detailTableView.frame = Frame_with_x_aligned_to_edge_of_peopleTable;
}
completion:^{ //stuff to do at the end of the animation
}];

关于macos - cocoa:如何实现表格动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11598847/

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