gpt4 book ai didi

iphone - 我在 UITableView header 中有一个 UIImageView。我怎样才能随时获得该 UIImageView 的确切 y/x 坐标?

转载 作者:行者123 更新时间:2023-11-28 19:19:45 25 4
gpt4 key购买 nike

我在 UITableView header 中有一个 UIImageView。我怎样才能随时获得该 UIImageView 的准确 y/x 坐标?

我需要知道屏幕上的确切 x/y 点,即使用户在 tableview 中上下滚动也是如此。如果可能的话,有人可以指点我一些示例代码吗?

仅仅调用这个是行不通的:

itemImageView.frame.origin.x, itemImageView.frame.origin.y

它只提供与 tableView 本身相关的坐标,而不管它在窗口上的实际位置。

谢谢。

最佳答案

我相信您想要的是 UIView convertPoint View 。您可以将获得的点转换为 TableView 的空间。

http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/convertPoint:toView :

关于iphone - 我在 UITableView header 中有一个 UIImageView。我怎样才能随时获得该 UIImageView 的确切 y/x 坐标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9899515/

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