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

我只是一个虾纸丫 提交于 2019-12-06 02:26:27

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.

you can add page based glance to your glance interface and add pages to the glance interface builder and u can see many pages...

You can only has one glance Inter face but you can setting the element on the glance inter face using the 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];
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!