没有得到值init()但是在swift中的viewDidload()方法中

时间:2014-12-22 07:46:25

标签: swift init viewdidload

我将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()方法?

0 个答案:

没有答案