在斯威夫特的行为中去掉

时间:2016-01-16 18:29:43

标签: ios swift memory-management deinit

我在Swift playground中编写了以下代码:

class View : UIView {
    let name = "myView"
    deinit {
        print("deinit View")
    }
}

class Controller: NSObject {
    var view: View

    init(view : View) {
        self.view = view
        super.init()
    }

    deinit {
        print("deinit Controller")
    }
}

var c : Controller? = Controller(view: View())
c = nil

控制台显示:

deinit Controller

我的问题不应该像下面那样?

deinit Controller
deinit View

0 个答案:

没有答案