Как программно получить раздел index.row и index из UITableViewCell с помощью UIStepper с использованием Swift 4

У меня большие проблемы с попыткой заставить UIStepper предоставить мне его indexPath.row и indexPath.section для их использования с двумерным массивом. Я искал пару часов и не нашел решения в Интернете, поэтому решил спросить. Пожалуйста, посмотрите этот код:

@objc private func stepperValueChanged(_ sender: UIStepper!){
    print("Stepper \(sender.tag) clicked. Its value \(sender.value)")
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
            let cell: ContactCell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath) as! ContactCell

    cell.myUIStepper.tag = indexPath.row
    cell.myUIStepper.addTarget(self, action: #selector(stepperValueChanged), for: .valueChanged)
    cell.cellDelegate = self

    let contact = twoDimensionalNamesArray[indexPath.section].names[indexPath.row]
    let contactInt = intsArray[indexPath.section][indexPath.row]
    cell.textLabel?.text = ("\(contact.name): \(contactInt)")
    print(contact.name)
    cell.accessoryView?.tintColor = contact.isFavorited ? .blue : .gray
    if showIndexPath == true {
        cell.textLabel?.text = "\(contact.name) -- \(indexPath.section), \(indexPath.row)"
    }
    return cell
}

Любая помощь будет принята с благодарностью.


person George Lee    schedule 30.06.2018    source источник
comment
проверьте этот ответ, я думаю это может помочь вам   -  person Pratik Prajapati    schedule 30.06.2018
comment
Взгляните на stackoverflow.com/questions/49832352/   -  person vadian    schedule 30.06.2018
comment
У вас есть несколько разделов?   -  person Roohul    schedule 30.06.2018