Switch to table view's sub detail view

I have a TTMSFMXNativeUITableView tv and a TTMSFMXNativeUIView vw which is used as a SubDetailView for the items of tv.

How can I programmatically switch to vw (push vw)? I tried:



tv.TableViewController.navigationController.pushViewController(vw.GetViewController, True);



but it didn't work.

hi, 


You should normally be able to directly access the navigationcontroller

tv.NavigationController.pushViewController(vw.ViewController, true);

Kind Regards, 
Pieter

Sorry, it didn't work, too, but I found that the code in TUITableViewDelegate.tableView(tableView: UITableView; didSelectRowAtIndexPath: NSIndexPathX) actually pushes the sub detail view for an item. Unfortunately, if I try to call this delegate method directly, a Bad System call is raised on accessing idx.section. Any ideas?

Ok. I figured it out. The following did the trick:



1. Add the following public property to TTMSFMXNativeUITableView:

    property DetailViewController : UIViewController read FDetailViewController;

2. In your form add the following lines of code:

    tv.DetailViewController.view.addSubview(vw);

    tv.NavigationController.pushViewController(tv.DetailViewController, True);



Hi, 

We have tried the code here so it is unclear how it didn't work, 
it is unclear why a public property would solve the issue as the code you are using is the same approach as the suggested code: tv.NavigationController.pushViewController(vw.ViewController, true);

Kind Regards, 
Pieter

In our application vw.GetViewController returns nil. I guess this is the reason why the table view uses a separate view controller (see property FDetailViewController) to push a view: to be not dependent on a view's view controller.

Meanwhile, I have defined a class helper for the table view, to overcome issue of defining a public property DetailViewController.

Is the viewcontroller hosted on a separate form?


Kind Regards, 
Pieter

No, everything is on one form, but there is no explicit TMSFMXNativeUIViewController on the form.