我真的需要帮助来制作这里的逻辑,所以我有 3 个不同的数组,我在我的UIPickerView
.当用户在选择器视图中选择这样的东西时,应该执行某个公式(它不相关)我应该使用什么? 如果语句?转变?还有一个问题。用作字符串的 shiftCount 数组数据会有问题吗?因为我需要将公式乘以 *1 或 *2 等。
var shiftCount = [
"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25"]
var Level = [
"White","Silver 80%","Silver 100%","Gold 80%","Gold 100%","Diamond 80%","Diamond 100%",]
var shiftDay = [
"MNG","LMNG","AFT","LAFT","PEAK","LNGT","NGT"]
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
switch (component) {
case 0:
MyShifts = shiftCount[row]
shifts.text = "How many shifts: " + MyShifts
print(MyShifts)
case 1:
MyShiftType = shiftDay[row]
shiftType.text = "Shift you work: " + MyShiftType
print(MyShiftType)
case 2:
MyLevel = Level[row]
level.text = "Your Level: " + MyLevel
print(MyLevel)
default:
break
}