swift(3.0) 内存地址的打印
2016-09-22 本文已影响481人
那夜孤舟
(1)方法:
Unmanaged.passRetained(对象名 as AnyObject)
这个方法不光会打印地址还会打印对象的内容;
let myview:UIButton = UIButton(frame:CGRect.init(x: 100, y: 100, width: 100, height: 100))
print("地址 : \(Unmanaged.passRetained(myview as AnyObject))")
打印:
(2)直接继承NSObject的类
print(对象名)