prepareForSegue getting called twice, with Attempt to present while presentation is in progress

后端 未结 3 1260
离开以前
离开以前 2021-02-14 01:06

I am new to ios programming and asking here, but I visit all the time! I am stumped at why I am getting this problem, it compiles with no errors and I have checked and checked

相关标签:
3条回答
  • 2021-02-14 01:38

    May be your segue is connection start form the table view cell instead of view controller.

    I had same issue I removed the segue from the table view cell and added back at view controller level.

    0 讨论(0)
  • 2021-02-14 01:49

    Rob's answer helped me, as well - thanks! I'm coding in Swift, so for those who run into this while Swifting, here's how to get the index (or index row) clicked on in Swift 3:

    var rowClicked = (self.tableView.indexPathForSelectedRow?.row)!
    
    0 讨论(0)
  • 2021-02-14 01:50

    The problem is prepareForSegue is called before didSelectRowAtIndexPath. You should just eliminate the didSelectRowAtIndexPath method, and do everything in prepareForSegue. You can use the following line to get the indexPath you need:

    NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
    
    0 讨论(0)
提交回复
热议问题