override init(){}在循环中运行

时间:2014-08-29 14:46:09

标签: swift xcode6-beta6

我遇到了在循环中运行的override init() {}方法的问题。直到它与exc_bad_access崩溃。

override init() {
    super.init()
    self.container = UIView()
    self.container.clipsToBounds = false

    println("self.container: \(self.container)")
    self.addSubview(self.container)

    self.contentCenter = CGPointZero
    self.contentScale = 1
    refreshContentTransform()

    self.panRecognizer = UIPanGestureRecognizer(target: self, action: Selector("handlePan:"))
    self.panRecognizer.maximumNumberOfTouches = 1
    self.panRecognizer.minimumNumberOfTouches = 1
    self.addGestureRecognizer(self.panRecognizer)

    self.pinchRecognizer = UIPinchGestureRecognizer(target: self, action: Selector("handlePinch:"))
    self.addGestureRecognizer(self.pinchRecognizer)
}

可能是什么触发器?

在调用init类之前。我通过var item = MyVar()初始化了该类的变量 跟踪断点。它永远不会离开那个init并以某种方式继续循环。 :/ 我希望有人能给我一些建议。感谢。

0 个答案:

没有答案