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

半世苍凉 提交于 2019-12-22 09:49:08

问题


I am trying to create a WatchKit App that needs to show multiple pieces of information to the users in form of glances.Is there a way to create multiple glances in such an app.


回答1:


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)



回答2:


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.




回答3:


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




回答4:


You can only has one glance Inter face but you can setting the element on the glance inter face using the glanceInterfacecController.swift




回答5:


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];


来源:https://stackoverflow.com/questions/28101841/can-we-create-multiple-glance-interfaces-in-a-single-watchkit-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!