这是我的代码。在此视图中,我想使用数组设置所有 16 个文本标签。当我按下这些文本标签之一下的按钮时,我需要使用 granigliatoreTF 中的字符串更改数据,然后重新加载所有 16 个文本标签。我只实现了一个按钮开始。谢谢大家
导入 UIKit
导入核心数据
类 DisposizioneGranigliatori: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource {
var disposizione = [NSManagedObject]()
@IBOutlet var granigliatoreTF: UITextField!
@IBOutlet var principale1LB: UILabel!
@IBOutlet var principale2LB: UILabel!
@IBOutlet var principale3LB: UILabel!
@IBOutlet var principale4LB: UILabel!
@IBOutlet var principale5LB: UILabel!
@IBOutlet var principale6LB: UILabel!
@IBOutlet var principale7LB: UILabel!
@IBOutlet var principale8LB: UILabel!
@IBOutlet var secondario1LB: UILabel!
@IBOutlet var secondario2LB: UILabel!
@IBOutlet var secondario3LB: UILabel!
@IBOutlet var secondario4LB: UILabel!
@IBOutlet var secondario5LB: UILabel!
@IBOutlet var secondario6LB: UILabel!
@IBOutlet var secondario7LB: UILabel!
@IBOutlet var secondario8LB: UILabel!
@IBOutlet var modifiche: UIView!
@IBOutlet weak var picker: UIPickerView!
var pickerData : [[String]] = [[String]]()
override func viewDidLoad() {
super.viewDidLoad()
modifiche.hidden = true
pickerData = [["12","161","164","165","176","177","245","246","247","250","255","256","262","263","266","267","268","269","270","271","274","275","278","287","289","290","293","301","303","306","307","308","328","330","336","337","340","344","346","347","352","355","357","374","377","381","383","387","391","394","395","399","400","401","403","417","421","423","430","F365","TGF 2666","FTS 2061"],["00","0,09","0,10","0,12","0,12-00","1400","Z","0,14-0,12","0,14","0,16","0,18","0,21","0,25","0,31","0,40","0,52","0,71"]]
self.picker.delegate = self
self.picker.dataSource = self
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// The number of columns of data
func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {
return pickerData.count
}
// The number of rows of data
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return pickerData[component].count
}
// The data to return for the row and component (column) that's being passed in
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return pickerData[component][row]
}
}
@IBAction func bigbagPrinc1(sender: AnyObject) {
}
@IBAction func bigbagSec1(sender: AnyObject) {
}
}