class func nodeWithAtom14(atom:SCNGeometry, molecule: SCNNode,position:SCNVector3) -> SCNNode {
var myPicker: UIPickerView!
let node = SCNNode(geometry: atom)
node.position = position
molecule.addChildNode(node)
var myCustomViewController: myViewController2 = myViewController2(nibName: nil, bundle: nil)
var getThatValue = myCustomViewController.content//pickerView3(myPicker,didSelectRow:1,inComponent:1)
println(getThatValue)
return node
}
Code in myViewController2:
var content: String = "hello"
//...
func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return pickerData.count
}
//MARK: Delegates
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
return pickerData[row]
}
func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) -> String! {
myLabel.text = pickerData[row]
content = "i"
if(pickerData[row] == "Mozzarella"){
let path = NSBundle.mainBundle().pathForResource("mozzarella", ofType: "txt")
var possibleContent = String(contentsOfFile:path!, encoding: NSUTF8StringEncoding, error: nil)
if var content = possibleContent {
}
}
if(pickerData[row] == "Gorgonzola"){
let path = NSBundle.mainBundle().pathForResource("gorgonzola", ofType: "txt")
var possibleContent = String(contentsOfFile:path!, encoding: NSUTF8StringEncoding, error: nil)
if var content = possibleContent {
}
}
return content
}
I would like to change 'content' with the picker, and then print it out in the Xcode console using println(getThatValue) in the first window. Right now it is just printing out 'hello' only once. How can I do that?