当我试图从另一个类访问它时,有没有人可以解释为什么我的NSMutableArray是空的?
MasterViewController
class MasterViewController: UITableViewController {
var mutOb:NSMutableArray = NSMutableArray()
override func viewDidLoad() {
var test: String = "test"
self.mutOb.insertObject(test, atIndex: self.mutOb.count)
super.viewDidLoad()
println(self.mutOb)
// RESULT ( test )
}
}
DetailViewController
class DetailViewController: UIViewController {
var masterViewController: MasterViewController = MasterViewController(nibName: nil, bundle: nil)
override func viewDidLoad() {
super.viewDidLoad()
println(self.masterViewController.mutOb)
// RESULT ( )
}
}