【发布时间】:2015-03-08 22:39:29
【问题描述】:
我正在尝试创建一个基于页面的 WatchKit 应用。当应用程序加载时,我希望在分页视图中有一个带有图像和按钮的页面,并且滑动应该在图像数组之间切换。
我试过WKInterfaceController.reloadRootControllersWithNames(["home", "home", "home", "home", "home"], contexts: ["1", "2", "3", "4", "5"]),其中home 是InterfaceController 的标识符。我从另一个 InterfaceController 调用此方法,它是初始接口控制器。我得到基于页面的视图,但初始视图是空白的。
import WatchKit
import Foundation
class InterfaceController: WKInterfaceController {
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
WKInterfaceController.reloadRootControllersWithNames(["home", "home", "home", "home", "home"], contexts: ["1", "2", "3", "4", "5"])
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}
}
- 使用
reloadRootControllersWithNames方法创建基于页面的应用程序是否正确?- 我应该在哪里调用这个方法?
- 除了情节提要中的箭头之外,是否有类似
AppDelegate的 WatchKit 入口点文件? - 我可以在情节提要本身中配置分页视图而不编写单独的代码吗?
- 现在我的整个视图都是分页的。我只想改变图像,我不希望按钮移动。我怎样才能做到这一点? http://www.apple.com/watch/films/#film-fitness 请查看此视频。我想要他们在 02:17 在这里显示的分页。
- 最后一件事是他们所做的动画。他们为文本和练习环显示的动画。如果有人能告诉我如何制作这样的动画,我将不胜感激。 :)
【问题讨论】:
-
你不应该同时在 Objective c 和 swift 中编码,选择其中一个标签:)
-
@penne12 我只是想让更多人看到我的问题,我认为 Objective-c 标签会有所帮助;)我的 Parent 应用程序是用 Objective-C 编写的。对于 WatchKit 扩展,我应该更喜欢 Objective-C 还是 Swift?
-
你最喜欢什么 :) 我认为是 Swift,但你应该探索你的选择 :)
标签: ios objective-c swift pagination watchkit