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,
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);
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?
No, everything is on one form, but there is no explicit TMSFMXNativeUIViewController on the form.