gpt4 book ai didi

iPhone:通过从顶部向下拉图像来滑入和滑出 View

转载 作者:行者123 更新时间:2023-12-03 21:18:38 25 4
gpt4 key购买 nike

我试图通过下拉图像来使 UIViewController (B) 出现在当前 UIViewController/UITableViewController (A) 上,该图像将从屏幕顶部显示 B。

导航栏正下方将有一个图像,放置在 A 的顶部,用户可以将图像向下拉到某个位置,露出一点 B,然后图像和 B 将动画向下移动到某个位置屏幕上,显示 B 的 UIViewController/UITableViewController。我在下面添加了 2 张图,希望能更好地阐明它?

First screen: User can pull down the image from the top revealing B as user pulls the image down http://www.petermumford.com/screen1.jpg Second screen: B is now revealed by the image sliding down after reaching its certain pull down position http://www.petermumford.com/screen2.jpg

如果可能的话,有人能给我指出正确的方向吗?非常感谢任何反馈。

最佳答案

只是为了提出一些建议;首先,是的,通过一些不太复杂的 UIView 动画和触摸处理方法处理,这是完全可能的。

研究以下触摸处理方法来为 UIImageView 创建“向下拖动”代码。您可以在 UIResponder 类引用下找到它们。使用这些方法,您将能够通过用户手指拖动来上下移动顶部 View Controller 的 View 。

– touchesBegan:withEvent:
– touchesMoved:withEvent:
– touchesCancelled:withEvent:

查找 UIView 动画,了解如何自动将前 View Controller “放置”到底部。您可以在 UIView 类引用下找到它们。它可能很简单,只需在 beginAnimations: block 中更改该特定 View 的框架即可。

注意:确保UIViewController A的self.view位于UIViewController B的self.view上方,这样当 Controller A移开时, Controller B会自动在下面可见。

关于iPhone:通过从顶部向下拉图像来滑入和滑出 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7428635/

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