gpt4 book ai didi

ios - 如何在 iwatch 中的两个 View Controller 之间传递数据?

转载 作者:可可西里 更新时间:2023-11-01 05:28:35 25 4
gpt4 key购买 nike

我正在开发一个向 iwatch 发送通知的应用程序。我想在下一个 View Controller 上显示通知消息,如何在基于页面的导航中将数据从通知 View Controller 传递到下一个 View Controller ?

最佳答案

来自Official Documentation :

When pushing a new interface controller, it is recommended that you pass a context object to the pushControllerWithName:context: method. A context object is your only way to communicate information to the new interface controller about what it should display. A context object can be an existing data object, or it can be a dictionary that you create dynamically and fill with relevant information.

If you prefer to use segues to initiate hierarchical navigation between interface controllers, WatchKit calls the contextForSegueWithIdentifier:inTable:rowIndex: or contextForSegueWithIdentifier: method based on whether the source of the segue was a table row or a button. Use those methods to provide the context object needed to initialize the new interface controller.

关于ios - 如何在 iwatch 中的两个 View Controller 之间传递数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27398281/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com