這是一個很大的問題,但它只是無法動畫兩組之間的變化與目前執行的WatchKit
。我絕對希望它也是如此。
您唯一的選擇是完全通過reloadRootControllersWithNames:contexts:
切換接口控制器,或使用您首先列出的方法顯示/隱藏一組組。下面是一個小例子,說明如何在頁面集中從SimpleInterfaceController
切換到FirstInterfaceController
和SecondInterfaceController
。
class SimpleInterfaceController : WKInterfaceController {
override func willActivate() {
super.willActivate()
let names = ["FirstInterfaceIdentifier", "SecondInterfaceIdentifier"]
WKInterfaceController.reloadRootControllersWithNames(names, contexts: nil)
}
}
我不知道在哪裏找到下面的代碼片段,但肯定不是在WKInterfaceGroup公共API的一部分。
atypeofGroup.animationDidStart(anim: CAAnimation!)
雖然我理解這些答案都不是理想的,但他們都是我們目前所能接觸到的。如果你有時間,我建議在蘋果的bug reporting system上提交功能請求。
嗨cnoon,謝謝你的回覆。沒有能力做這樣的事情http://stackoverflow.com/questions/7060070/how-to-unhide-view-with-animations for watchkit肯定讓我頭疼。你能否提供一個關於如何使用reloadRootControllersWithNames的例子:contexts:?什麼是atypeofGroup.animationDidStart(anim:CAAnimation!)btw的用法? – user1872384 2015-03-04 02:54:24
嗨用戶,我編輯了我的答案,以解決您的評論中的後續問題。希望這有助於讓事情變得更加清晰。 – cnoon 2015-03-04 04:11:58
Thx!這仍然不是理想的答案,雖然...現在會接受它... – user1872384 2015-03-04 04:26:46