微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决从 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 举报,一经查实,本站将立刻删除。