简体   繁体   中英

Can we create multiple glance interfaces in a single Watchkit app?

我正在尝试创建一个WatchKit应用程序,需要以一瞥的形式向用户显示多条信息。有一种方法可以在这样的应用程序中创建多个目光。

You cannot make more than one glance per application

But nothing prevents you from creating one glance, that will contain all possible states of "each glance type", and then, in runtime perform hide/show of specific components of the glance.

Glance  
  Top Group
    State1
    State2 (hidden)
    StateN (hidden)    
  Bottom Group 
    State1
    State2 (hidden)
    StateN (hidden)

There could be only one glance in a WatchKit App. Try to put another Glance Interace Controller into interface storyboard and try to compile. Xcode will give you an error: "Illegal Configuration. The application may only contain a single glance interface". The official documentation is also telling only about one glance per app.

您可以将基于页面的视图添加到您的浏览界面并将页面添加到glance界面构建器中,您可以看到许多页面...

你只能只看一眼Inter face,但你可以使用glanceInterfacecController.swift在一瞥界面上设置元素。

According to the WatchKit Programming Guide 1 Glance Interface Controller per app.

An app has only one glance interface controller, so that one controller must be able to display the data you want. Focus on the most important data.

There is nothing stated in the guidelines to prevent you from implementing multiple 'hidden' WKInterfaceGroups in your Glance Controller and unhiding the most relevant group needed based on the current context (time, location) of the user.

[myLabel setHidden:NO];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM