Ошибка "Thread 1: signal SIGABRT"
при переходе ко второму viewController (класс "Type1ViewController"), перепробовал все не могу пофиксить, вот код из ViewController.swift и скрин Main.storyboard:
Классы view-шек проверил совпадают.
Ошибка также возникает при отсутствии всех TextField-ов на втором экране.
Ошибка отображается вот здесь в AppDelegate:
import UIKit
var position: Int = 1
var positionSecondBack: Int = 0
var answer: String = ""
//=======================================================================
//------------------------ first view controller ------------------------
//=======================================================================
class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate {
@IBOutlet weak var LabelTypeEc: UILabel!
@IBOutlet weak var LabelType: UILabel!
@IBOutlet weak var Button1: UIButton!
@IBOutlet weak var Button2: UIButton!
@IBOutlet weak var Button3: UIButton!
@IBOutlet weak var Next1Butt: UIButton!
@IBOutlet weak var ProblemTypePicker: UIPickerView!
@IBOutlet weak var PickerAP: UIPickerView!
@IBOutlet weak var PickerDP: UIPickerView!
@IBOutlet weak var PickerV: UIPickerView!
override func viewDidLoad() {
super.viewDidLoad()
ProblemTypePicker.layer.cornerRadius = 15
PickerAP.layer.cornerRadius = 15
PickerDP.layer.cornerRadius = 15
PickerV.layer.cornerRadius = 15
LabelTypeEc.layer.cornerRadius = 5
LabelType.layer.cornerRadius = 5
Button1.layer.cornerRadius = 15
Button2.layer.cornerRadius = 15
Button3.layer.cornerRadius = 15
Next1Butt.layer.cornerRadius = 15
Button1.setTitle(" Вопросы ", for: .normal)
Button2.setTitle(" Вопросы ", for: .normal)
Button3.setTitle(" Вопросы ", for: .normal)
ProblemTypePicker.delegate = self
ProblemTypePicker.dataSource = self
PickerAP.delegate = self
PickerAP.dataSource = self
PickerDP.delegate = self
PickerDP.dataSource = self
PickerV.delegate = self
PickerV.dataSource = self
}
var list1 = ["аннуитентные платежи", "дифференцированые платежи", "вклады"]
var list2 = ["1-ый тип", "2-ый тип", "3-ый тип"]
var list3 = ["4-ый тип", "5-ый тип", "6-ый тип"]
var list4 = ["7-ый тип", "8-ый тип", "-"]
//how much stacks in pickerView
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
var countrows : Int = list1.count
if pickerView == ProblemTypePicker { countrows = self.list2.count }
return countrows
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
if pickerView == ProblemTypePicker {
let titleRow = list1[row]
return titleRow
} else if pickerView == PickerAP {
let titleRow = list2[row]
return titleRow
} else if pickerView == PickerDP {
let titleRow = list3[row]
return titleRow
} else if pickerView == PickerV {
let titleRow = list4[row]
return titleRow
}
return ""
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if pickerView == ProblemTypePicker {
//buttons witch allow us go to "Type docs"
//and
//PickerViews what contain from "1 Type" to "9 Type"
if row == 0 {
position = 1
PickerAP.isHidden = false
PickerDP.isHidden = true
PickerV.isHidden = true
Button1.isHidden = false
Button2.isHidden = true
Button3.isHidden = true
} else if row == 1 {
position = 4
PickerAP.isHidden = true
PickerDP.isHidden = false
PickerV.isHidden = true
Button2.isHidden = false
Button1.isHidden = true
Button3.isHidden = true
} else if row == 2 {
position = 7
PickerAP.isHidden = true
PickerDP.isHidden = true
PickerV.isHidden = false
Button3.isHidden = false
Button2.isHidden = true
Button1.isHidden = true
}
}
//what type of problem
if pickerView == PickerAP {
if row == 0 { position = 1
} else if row == 1 { position = 2
} else if row == 2 { position = 3
}
}
if pickerView == PickerDP {
if row == 0 { position = 4
} else if row == 1 { position = 5
} else if row == 2 { position = 6
}
}
if pickerView == PickerV {
if row == 0 { position = 7
} else if row == 1 || row == 2 { position = 8
}
}
if position == 1 {
Next1Butt.isHidden = false
} else if position == 2 {
Next1Butt.isHidden = true
} else if position == 3 {
Next1Butt.isHidden = true
} else if position == 4 {
Next1Butt.isHidden = true
} else if position == 5 {
Next1Butt.isHidden = true
} else if position == 6 {
Next1Butt.isHidden = true
} else if position == 7 {
Next1Butt.isHidden = true
} else if position == 8 {
Next1Butt.isHidden = true
} else if position == 9 {
}
}
}
//=======================================================================
//---------------------- 1 Type1ViewController 1 ------------------------
//=======================================================================
class Type1ViewController: UIViewController {
@IBOutlet weak var LabelType: UILabel!
@IBOutlet weak var ButtonBack: UIButton!
@IBOutlet weak var ButtonNext: UIButton!
@IBOutlet weak var Label1: UILabel!
@IBOutlet weak var Label2: UILabel!
@IBOutlet weak var Label3: UILabel!
@IBOutlet weak var Lanel4: UILabel!
//textFields
@IBOutlet weak var TextField_1Type_1: UITextField!
@IBOutlet weak var TextField_2Type_1: UITextField!
@IBOutlet weak var TextField_3Type_1: UITextField!
@IBOutlet weak var TextField_4Type_1: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
ButtonBack.layer.cornerRadius = 15
ButtonNext.layer.cornerRadius = 15
}
}