我创建了一个 WatchKit 应用程序基于页面的界面 https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/InterfaceStyles.html#//apple_ref/doc/uid/TP40014969-CH12-SW1.
有 3 页,每一页都连接到我的InterfaceController.swift类(扩展WK接口控制器).
我的问题:在 InterfaceController.swift 中如何检测当前视图的页码?
如果你使用
func presentControllerWithNames(_ names: [AnyObject],
contexts contexts: [AnyObject]?)
您只需在上下文中传递页面编号,以便可以存储它并稍后检索它。这是非故事板的方式。
如果你使用storyboard,也是一样的,只是需要使用另一种方法
func contextsForSegueWithIdentifier(_:inTable:rowIndex:)
并在每个控制器的上下文中传递页面索引
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)