如何在 iPhone 中创建可拖动对象或控件?

发布于 2024-10-13 01:03:07 字数 173 浏览 5 评论 0原文

我正在开发一个 iPhone 应用程序,其中一些值已写在 UILable 或 UIButton 上。我想问一下如何将这些控件拖到另一个位置。

请为我提供一些 iPhone 的示例。

是否可以将这些控件拖到 UITableView 中,然后保存 UITableView 值?

提前致谢。

I was developing a iPhone application in which some value has been written down on UILable or UIButton. I want to ask that how can i drag these control to another location.

Please provide me some example of iPhone for this.

Can it is possible to drag these control into UITableView and then save UITableView values ??

Thanks in Advance.

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

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

发布评论

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

评论(2

世界如花海般美丽 2024-10-20 01:03:07

你可以从逻辑上做到这一点。

认为您在视图中的特定坐标处有一个表格视图。并且您有一个带有一些文本的标签,那么您可以使用触摸委托方法移动该标签。

触摸移动

及使用

触摸结束

为您的逻辑,在这里您可以将该标签文本保存在您显示表格内容的数据源数组中并使用 [YourTabl reloadData];并完成该标签的存在。

我认为这是有道理的。

You can do this logically.

Think you have an table view at particular co-ordinates in view. and you have a label with some text then you can move that label by using Touch Delegate methods.

touchesMoved

and the use

touchesEnd

for you logic,here you can save that label text in your data source array from where you display the table content and use [YourTabl reloadData]; and Finish that label presence.

I think it makes sense.

你的背包 2024-10-20 01:03:07

是的,您可以拖动任何 UIView。 中更改视图中心即可

只需在- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event

Yes you can drag any UIView. Just change the center of your view in

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event

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