如何在1个UIViewController的不同内容中添加页面切换动画效果?

发布于 2024-10-09 13:22:26 字数 318 浏览 0 评论 0原文

我有一个 UIViewController 用于显示我朋友的数据。该控制器支持滑动手势:向左滑动屏幕将转到下一个好友的数据,向右滑动则返回上一个。所以它只有1个UIViewController,整个过程只是重新加载新数据并在从服务器api返回不同内容时刷新UI。

是否有可能在滑动和内容更改中添加页面切换效果,就像它们在不同的 UIViewController 中一样?我的代码基本上是这样的结构,

1.[传递好友id,获取服务器api返回]; 2.[解析它并在UI上填充内容]; 3.[滑动检测]; 4.[通过传递新的好友ID重新加载数据,然后重复1-4];

提前致谢!

I have an UIViewController on showing my friends' data. This controller supports swipe gesture: swipe the screen left will transfer to next friend's data, to right back to previous. so it is only 1 UIViewController, the whole process just reloads new data and refreshes UI when different content reading from server api returns.

is it possible that adding a page switch effect in swipe and content change, like they are in different UIViewController? my code is basically like this structure,

1.[passing friend id, get server api return];
2.[parsing it and populate content on UI];
3.[swipe detect];
4.[reload data by passing a new friend id then repeat 1-4];

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你的笑 2024-10-16 13:22:27

我建议你使用这种结构:1个父控制器,2个子控制器。每当触发翻页操作时,父级就会关闭当前的子级并呈现另一个。

这样就可以借助UIViewAnimationTransitionCurlUp系统动画效果轻松实现翻页动画。

I suggest you use this structure: 1 parent controller, 2 children controllers. Whenever a turn-the-page action is triggered, the parent dismisses the current child and presents the other.

In this way you can implement the turn-the-page animation with ease, with the UIViewAnimationTransitionCurlUp system animation effect.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文