我将dat从另一个viewcontroller传递到tableview?
我在viewDidload方法中获得了价值,但在init()方法中却没有。
@IBOutlet var uiTblCompanyResultView: UITableView!
var companyName=""
var countryCode=""
var townCode=""
required init(coder aDecoder: NSCoder) {
// ERROR: Property 'self.animator' not initialized at super.init call
super.init(coder: aDecoder)
println("init company \(companyName)")
println(countryCode)
println(townCode)
}
//init(companyName : String, countryCode : String) {
// self.companyName = companyName
// self.countryCode = countryCode
//}
override func viewDidLoad() {
super.viewDidLoad()
println("viewDidLoad company \(companyName)")
println(countryCode)
println(townCode)
// Do any additional setup after loading the view, typically from a nib.
}
dispatch_async(dispatch_get_main_queue()) {
let viewcomapnyResultController = self.storyboard?.instantiateViewControllerWithIdentifier("companyResultController") as viewCompanyResultController
viewcomapnyResultController.companyName=self.txtFieldCompName.text
viewcomapnyResultController.countryCode=self.countryCode
viewcomapnyResultController.townCode=self.townCode
self.showViewController(viewcomapnyResultController as UIViewController, sender: viewcomapnyResultController)
}
请你告诉我......我怎样才能获得数据init()方法?