我想要相对于主窗口的坐标,因此我使用 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 内重要吗?