IOS StoryBoard multiple Segue's from a TableCell

后端 未结 4 1680
眼角桃花
眼角桃花 2020-12-12 15:15

Hi I have a storyboard and am able to show a detail view when clicking on a table cell. I want to add extra functionality so that depending on what cell I click I show a dif

4条回答
  •  囚心锁ツ
    2020-12-12 15:34

    In swift 3.1, with a segment control of two states

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    var segue: String!
    if selectedSegment == 0 {
        segue = "segue1"
    } else  {
        segue = "segue2"
    }
    self.performSegue(withIdentifier: segue, sender: self)
    

    }

提交回复
热议问题