interact the navigation controller bar button with embed container view
Asked Answered
E

2

3

enter image description here

I've created a UIViewController, and insert a container view in it, which embed a UITableViewController. As the image described above.

When user click the Table View Cell, I'd like to add a UIBarButton on the Navigation bar.

But, how can I manage this? I can rise the DatePicker when click on Table View Cell, but when I call self.presentingViewController in table view controller implementation file, it returns (null), same as when I call self.parentViewController

Estranged answered 29/1, 2013 at 10:13 Comment(0)
S
6

You're probably trying to access the parent controller too early. If you log self.parentViewController in viewDidLoad, it will return null, but it should return the correct controller from viewDidAppear, and certainly from the didSelectRowAtIndexPath method. Using parentViewController in this context is correct, not presentingViewController.

Salta answered 29/1, 2013 at 17:11 Comment(0)
K
0

I'd suggest to implement the UITableViewController Delegates and Datasource Methods in the ViewController itself. That way you don't have to worry about accessing the ViewController containing the UITableView.

Kant answered 29/1, 2013 at 10:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.