【发布时间】:2011-06-07 07:31:32
【问题描述】:
我想要相对于主窗口的坐标,因此我使用 convertRect:toView: 和 nil 作为第二个参数:
CGRect result = [self.view convertRect:addToList.frame toView:nil];
但结果,我总是得到
NSRect: {{5, 30}, {35, 35}}
这正是我用于生成 addToList-view 的值:
addToList = [UIButton buttonWithType:UIButtonTypeCustom];
addToList.frame = CGRectMake(5.0f, 30.0f, 35.0f, 35.0f);
如果我将 addToList 按钮添加到位于屏幕右下角的视图中,我希望在 iPad 横向上使用 CGRect,例如 950、700、35、35,因为这些是按钮相对于最顶层视图的坐标。
首先,我在 UIViewController 的 initWithFrame:-method 中进行了转换;但是现在,我在做之后......我错过了什么?
谢谢!
编辑:“self.view”在 UIScrollView 中重要吗?
【问题讨论】: