从 RowSelected 事件更改 ViewController/触发 Segue - Xamarin

问题描述

我正在尝试在按下表格中的一行时发生一些事情。此事件应触发视图控制器中的更改。 我尝试了多种方法来做到这一点,包括使用 NavigationController 技巧,但都没有成功。到目前为止,以下是我在 RowSelected 函数中尝试过的。 (注意:owner 是包含 UITableViewSource 的根 ViewController)

// I tried multiple ways with Segues.
owner.PerformSegue("ShowChat",owner)

// This is another way that I tried out of curiosity
owner.PerformSegue("ShowChat",this)

一个简单地返回“对象未设置为对象的实例”错误,显然我的导航控制器为空,我还没有找到解决方法

ChatController chatController = this.owner.Storyboard.InstantiateViewController("ChatScreen") as ChatController
owner.NavigationController.PushViewController(chatController,true)

这里有一些我也尝试过的东西的链接

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)