如何在1个UIViewController的不同内容中添加页面切换动画效果?
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议你使用这种结构: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.