我有一个选择器视图和每个选择器行编程的表视图,我想通过UIButton连接它们。有关快速功能的建议,将Pickerview行与botton连接起来打开选择器表吗? (以下代码) 谢谢!
class ViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource {
@IBOutlet weak var Picker1: UIPickerView!
var Array = ["G: Classroom friendly", "PG-13: Swear words OK(no sexual innuendo)", "R: Anything goes!"]
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
Picker1.delegate = self
Picker1.dataSource = self
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return Array[row]
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return Array.count
}
public func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
@IBAction func Submit(_ sender: Any) {
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
}
@IBAction func ContinueBotton(_ sender: UIButton) {
}
}
class ViewController1: UITableViewController {
@IBOutlet var ViewController1: UITableView!
var GRating = [GN]()