- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何以编程方式获取 WKInterfaceGroup 对象的背景颜色?
您可以 set the value使用
- (void)setBackgroundColor:(nullable UIColor *)color;
但是你也能得到吗?
最佳答案
您可以在接口(interface)对象上设置值,但不能获取其属性的当前值。
这个答案可以在 WKInterfaceObject
中找到父类(super class)文档:
Communication between an interface object in your extension and the corresponding interface element in your Watch app is one way. You can set the values of an interface object, but you cannot get the current values. If you want to know the current value of an attribute, you must save the value yourself.
下面是一个示例,显示如何维护您自己的组颜色值:
@IBOutlet weak var myGroup: WKInterfaceGroup!
var myGroupBackgroundColor: UIColor?
// Set the group's color, also save the color for future reference
myGroupBackgroundColor = UIColor.blue()
myGroup.setBackgroundColor(myGroupBackgroundColor)
然后您可以使用 myGroupBackgroundColor
属性获取组的当前颜色。
关于ios - 以编程方式获取 WKInterfaceGroup 的背景颜色 (WatchKit),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38055637/
简单的问题:是否可以堆叠一个 WKInterfaceLabel在另一个内部的顶部 WKInterfaceGroup ?我像个疯子一样拖着,我无法将蓝色目标线设置在第一个标签的上方或下方。它会坐在它旁边
此问题中的解决方案* 使用 setHidden 来隐藏和取消隐藏 WKInterfaceGroup: atypeofGroup.setHidden(true) atypeofGroup
我正在使用 xCode 6.2 beta 2 并尝试以编程方式隐藏和显示组,但没有显示我可以编写 group.hidden=YES 或 group.hidden=NO 的方法有没有其他方法可以做到这一
我正在创建一个 WatchKit 2.0 应用程序,其中包含成员之间的对话。在对话线程中,我希望将 WKInterfaceGroup's 半径设置为 3 个角,如下所示: 在界面生成器中,我知道您只能
有没有办法以编程方式访问 WKInterfaceGroup 的子元素,而不是 Ctrl + 从界面构建器中拖动? 最佳答案 不,WatchKit 不允许您以编程方式访问接口(interface)对象属
(使用iOS8.3、Xcode6.3、OSX10.10.3) 嗨,我想知道 WatchKit WKInterfaceGroup 是否可以是按钮?? 在我的 watchkit 应用程序中,我想针对特定操
我在 WKInterfaceGroup 中有一个带有长文本的标签和一个按钮。我可以在按钮的触摸处理程序上将组滚动到顶部吗? 最佳答案 您可以从 WatchOS 4 开始执行此操作。WKInterfac
如何以编程方式获取 WKInterfaceGroup 对象的背景颜色? 您可以 set the value使用 - (void)setBackgroundColor:(nullable UIColor
我正在显示带有如下标签的圆形进度条: 我通过创建 WKInterfaceGroup 并将其图像设置为动画图像来实现此目的,然后我将 WKInterfaceLabel 居中放置。现在我想在用户单击标签或
我正在使用 iOS SDK 8.3 并尝试遵循 this tutorial在 watch 套件应用中创建表格。 我在 iWatch 应用程序的界面 Controller 上添加了一个表,然后将其链接到
我知道这个问题可能看起来很奇怪,但我看到的这个 YouTube 视频正是我想要的。基本上在视频中它显示了一个侧面有彩色条纹的“WKInterfaceGroup”。我想知道是否有一种本地方法可以做到这一
我是一名优秀的程序员,十分优秀!