相对于 ScrollView 转换 CGRect?

发布于 2025-01-01 23:20:50 字数 330 浏览 3 评论 0原文

在我的 iPad 应用程序中....

类别匹配应用程序..

我有我的主视图....

在该视图中,我的主视图中有两个子视图.. .

  1. 单元格视图
  2. 滚动视图。

问题是当我将单元格视图拖动到滚动视图时, cellView 应该相对于滚动视图转换其矩形。

您能给我建议吗

Convert Rect ToFrame

Convert Rect FromFrame

In my iPad app....

CATEGORY MATCHING APP..

I have my main view....

In that View I have two sub Views in my main view...

  1. Cell View
  2. Scroll View.

The problem is when I am dragging a cell view to a scroll view, cellView should convert its rectangle relative to the scrollview..

Could you suggest me the

Convert Rect ToFrame

Convert Rect FromFrame

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

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

发布评论

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

评论(1

泪冰清 2025-01-08 23:20:50

UIView 为此目的提供了 ConvertRect 方法。看一下:

convertRect:toView:

例如:

CGRect newFrame = [self convertRect:self.bounds toView:nil];

这会在与窗口相同的位置获得一个新框架。

UIView has convertRect methods for this very purpose. Have a look at:

convertRect:toView:

For example:

CGRect newFrame = [self convertRect:self.bounds toView:nil];

This gets a new frame in the same place as the window.

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