How to reference tableView from a view controller during a segue

前端 未结 4 605
旧时难觅i
旧时难觅i 2020-12-15 11:35

I\'m new to iOS development, so go easy on me please :)

Using Xcode 4.2 for iOS 5, I\'ve built a view controller in IB, with a tableview inside it linked to a detail

4条回答
  •  执笔经年
    2020-12-15 11:59

    I'm also new to iOS, but for what it's worth this:

    NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow];
    

    worked for me in prepareForSegue. Thanks, I was trying to figure out how to get the currently selected row...

    I'm not sure what you mean by "I've built a view controller in IB, with a tableview inside", but it sounds like your segue source is a UIViewController, not a UITableViewController? Your class needs to subclass UITableViewController for tableView to exist.

提交回复
热议问题