2016-10-24 2 views

ответ

1

в вашем TableViewController:

 var chosenNumber = 0 

     override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 
      //set your chosenNumber here based on your the cell that was clicked 
      chosenNumber = 1 
     } 

     override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) { 

      let controller = segue.destinationViewController as! ViewController 
      //the startRow variable in the ViewController with the picker is set to the same value as the chosenNumber 
      controller.startRow = chosenNumber 

     } 

в вашем ViewController с подборщиком:

 var startRow = 0 
     override func viewDidLoad() { 
      //the selected item in the spinner will the value of startRow 
      spinner.selectRow(startRow, inComponent: 0, animated: false) 

     } 

скрыть вертушку при нажатии кнопки:

 @IBAction func buttonClicked(sender: UIButton) { 
      spinner.hidden = true 
     } 
Смежные вопросы