无法使用基于super.view.frame的CGRect创建Struct

时间:2015-06-19 11:09:38

标签: swift struct cgrect

我尝试创建CGRect个对象的查找,但我遇到了障碍。

如果我要在CGRect中初始化viewDidLoad(),它将类似于:

let myRect = CGRect(x: (view.frame.width / 2) - 50, y: (view.frame.height / 2) - 50, width: 100, height: 100)

但是如果它在一个Struct标记内:

'mainViewController.Type' does not have a member named 'view'

我似乎以错误的方式解决这个问题,所以有人可以更好地了解我实施的目标吗?

非常感谢。

0 个答案:

没有答案