ビューがどのように動作するか私はまだ学んでいるが、私はクラスのサブクラスであるクラスGraficsBalancGlobalViewController
を得ました... 私は解決できなかった問題を発見GraficViewController
は、プログラムの暴走になり
class GraficsBalancGlobalViewController: GraficViewController {
@IBAction func afegeixGrafic(sender: NSButton) {
addNewGrafic() // which is set on the GraficViewController
}
}
そして、私はライン上IBAction afegeixGrafic
私のプログラムのクラッシュを実行すると、以下のマーク:
class GraficViewController: NSViewController, GraficViewDataSource {
@IBAction func button(sender: NSButton) {
addNewGrafic()
}
func addNewGrafic() {
let frame = NSRect(x: 0, y: 0, width: self.view.bounds.width , height: self.view.bounds.width * 0.25)
let nouGrafic = GraficView(frame: frame)
scrollView.addSubview(nouGrafic) <---- BREAK here!
}
@IBOutlet weak var scrollView: NSView!
//...more code
}
コンパイラがそれを言います
GraficViewController
のボタン(IBAction)がうまくいきます!だから、私はそれと作品を試すためGraficView(frame: frame)
が問題ではないことを言及する
- ..私は問題がscrollViewと関連していると仮定し、私は...それが初期化されることができるものの見当がつかないよく
あなたの 'IBOutlet'で' scrollView'をチェックしましたか? – Caleb
ブレークポイントをこの行に追加し、ブレークタイプ "p scrollView"をデバッガコンソールに追加します。 scrollViewはnilですか? – Darko
@Drakoはい!あなたは右のscrollViewViewはnillですが、それは存在する、それは画面上にある! –