启动观看应用程序进入中间视图
基本上,我的应用程序是以页面格式进行布局的,我希望它能够进入三页的中间。 有没有办法设置一个先前的页面segue,所以我一直在尝试在代码中做到这一点。
我有主视图设置为第一个视图,并且我尝试了各种方法,在应用程序启动后立即转到中间视图。
以下是我尝试的两种方法:
if segueCheck == true { self.pushControllerWithName("budget", context: self) self.presentControllerWithName("budget", context: self) segueCheck = false }
第一个提出的观点,但作为一个完全分开的观点,第二个取代第一个观点与中间的观点。
有谁知道我可以如何启动到中间视图,并允许用户左右滑动?
谢谢。
WKInterfaceController
的becomeCurrentPage()
应该是你在找什么。
让我们为中心视图控制器CenterPageViewController
创build一个新类, CenterPageViewController
如下所示更改它的initWithContext:
方法
import WatchKit class CenterPageViewController: WKInterfaceController { override init(context: AnyObject?) { super.init(context: context) super.becomeCurrentPage() } }
现在,让我们将Storyboard中的中间页面的Custom Class设置为CenterPageViewController
终于碰上了跑步。
您将无法摆脱从左侧页面到中间页面的初始转换,但应用程序最终将从中间页面开始。
更新Swift 3.0
class CenterPageViewController: WKInterfaceController { override init (){ super.init() super.becomeCurrentPage() } }
这将起作用… !!!
谢谢
- 通过Watch OS2拨打电话
- 在Objective-C中如何将数据从Iphone发送到OS2中的Apple Watch
- 如何获得Apple Watch硬件标识符?
- 将二进制file upload到iTunes时出现的问题在高Sierra上使用Xcode 9进行连接(ERROR ITMS-90391)
- 如何在iOS中识别不同的连接手表
- 当用户停止说话时,如何停止Apple Watch中的语音识别(听写)?
- SF Compact是WatchOS2中的默认系统字体吗?
- 在WatchOS2中使用WatchConnectivity在iOS和WatchOS之间发送消息
- NSUserDefault在watchppExtension中更改通知处理