(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(对象名)
网友评论