Hi, I have a view table controller name MyTableViewController. In MyTableViewControllerI use different UIPickerViewinside different celltables, which is called the name headerCell, which is set by the following function and in this I do not useUIPickerView
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerCell = tableView.dequeueReusableCell(withIdentifier: "header") as! MyTableViewCell
headerCell.contentView.backgroundColor = UIColor.white
return headerCell
}
MyTableViewCell- is a class type UITableViewCell, which I tied all the tables, such as Label, TextField, Button, UIPickerViewetc.
My second cell is middleCella footerCell, which is equal to
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cell : SubscriptionTableViewCell?
if indexPath.row == 1 {
cell = tableView.dequeueReusableCell(withIdentifier: "footer", for: indexPath) as? SubscriptionTableViewCell
cell!.cardTypePicker.delegate = self
cell!.expMonth.delegate = self
cell!.expYear.delegate = self
cell!.countryPicker.delegate = self
cell!.shippingMethodPicker.delegate = self
cell!.cardTypePicker.dataSource = self
cell!.expMonth.dataSource = self
cell!.expYear.dataSource = self
cell!.countryPicker.dataSource = self
cell!.shippingMethodPicker.dataSource = self
}else {
cell = tableView.dequeueReusableCell(withIdentifier: "middle", for: indexPath) as? SubscriptionTableViewCell
cell!.variantPicker.delegate = self
cell!.variantPicker.dataSource = self
}
return cell!
}
as you can see, there are different ones UIPickerView. So now I can’t understand how to use delegates UIPickerViewinside UITableViewController.
Please help for this.