Ios 如何使用pickerView和UIbutton对象根据pickerView中选择的项目转到不同的视图

Ios 如何使用pickerView和UIbutton对象根据pickerView中选择的项目转到不同的视图,ios,iphone,swift,Ios,Iphone,Swift,问题下方有图像链接。您是否在“选取器”视图中添加了按钮?我想您在问题标题中写下了所有描述,然后找到答案,只需使用SelectedRowUncomponent方法获取按钮操作中pickerview的索引这是选择其他视图控制器的方法吗?让SecondViewController:SecondViewController=SecondViewController()self.presentViewController(SecondViewController,动画:true,完成:nil) @IBAc

问题下方有图像链接。您是否在“选取器”视图中添加了按钮?我想您在问题标题中写下了所有描述,然后找到答案,只需使用SelectedRowUncomponent方法获取按钮操作中pickerview的索引这是选择其他视图控制器的方法吗?让SecondViewController:SecondViewController=SecondViewController()self.presentViewController(SecondViewController,动画:true,完成:nil)
@IBAction func EnterButton(sender: AnyObject) {

    func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int)
    {
        switch(row)
        {
        case 0:
            let SecondViewController:secondViewController = secondViewController()
            self.presentViewController(SecondViewController, animated: true, completion: nil)


        default:
            break

        }
    }