3 回答
TA贡献1859条经验 获得超6个赞
var corX = 0var corY = 0var panzer = UIImageView(frame: CGRectMake(corX, corY, 30, 40))
panzer
self.corX
self.corY
self
self
class ViewController: UIViewController { var corX : CGFloat = 0 var corY : CGFloat = 0 lazy var panzer : UIImageView = UIImageView(frame: CGRectMake(self.corX, self.corY, 30, 40)) // ...}
panzer
self
TA贡献1876条经验 获得超7个赞
lazy
明示 : Type
使用 self.
访问其他属性
let original = "foo"
// Good:
lazy var depend: String = self.original
// Error:
var noLazy: String = self.original // Error: Value of type '(NSObject) -> () -> URLData' has no member 'original'
lazy var noType = self.original // Error: Value of type '(NSObject) -> () -> URLData' has no member 'original'
lazy var noSelf: String = original // Error: Instance member 'original' cannot be used on type 'YourClass'
- 3 回答
- 0 关注
- 498 浏览
添加回答
举报