问题标签 [wkinterfacelabel]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
659 浏览

ios - WKInterfaceLabel in custom WKInterfaceTable row unwrapping to nil

The title sums it up. I've tried disconnecting/reconnecting all the IBOutlets. Here's the code on my InterfaceController where I set up the WKInterfaceTable:

Here's the code for my UniversalRowView which is my custom row class:

The IBOutlets for the Table is properly connected. The row on Storyboard is set to type UniversalRowView and outlets for both labels are properly connected.

The line:

throws the following error: "fatal error: unexpectedly found nil while unwrapping an Optional value"

Also, when I comment that code out, I don't see the stock WKInterfaceLabels on the simulator as they appear on the Storyboard. I feel like this is an error as well but I don't know what to make of it.

Edit: Calling setupLoadingTable() in willActivate()

0 投票
1 回答
101 浏览

swift - 不知道为什么这个基本的 watchOS 2 应用程序不起作用

这是我学习编码的第一天。我想使用 watchOS 2 制作一个简单的 WatchKit 应用程序。

我启动并运行了 Hello World 应用程序,现在当我尝试让菜单按下触发标签进行更改时,代码将无法编译,并出现以下错误:

WKInterfaceLabel 没有名为 set 的成员。

你可以在这里看到详细的图像。

SWIFT代码:

0 投票
1 回答
1019 浏览

ios - 如何在 Apple Watch 应用程序中访问 WKInterfaceLabel 的文本属性

我想在 InterfaceController 中输入一个 if 语句,它基本上像 -

WKInterfaceLabel似乎只是拥有setText()财产。那么如何访问WKInterfaceLabel's text 属性?提前致谢!

0 投票
2 回答
271 浏览

ios - WKInterfacelabel 检查是否被截断

我想检查 WKInterfacelabel 中的文本是否被截断。由于没有文本属性,而且似乎我无法获得可以在情节提要中设置的行数属性,我想知道是否有任何方法或技巧来实现这一点!?

谢谢 !

0 投票
2 回答
778 浏览

ios - WKInterfaceLabel 最小比例如何工作?一旦设置值,它就会被忽略

我正在设置这样的 WKInterfaceController:

(将 RTC 读取为相对于容器,AL 为对齐,STF 为适合内容的大小)

表示如下所示:

标签接口

如果文本太大而无法留在其中,我希望中组中包含的标签的字体缩小(如果它多行也可以)。为了实现这一点,我将字体设置为系统粗体 30,Min Scale值设置为 0.5,Lines值设置为 0,但是所有内容都被忽略并且文本被中继或(取决于容器/标签的配置)它超出组边界。

我错过了什么?我已尝试遵循此问题中包含的答案,但未能使其正常工作。

0 投票
1 回答
52 浏览

ios - 7.1 兼容目标的 WatchKit 扩展:WKInterfaceLabel

我正在尝试将 WatchKit 目标添加到仍支持 iOS 7.1 的应用程序中。我认为应用程序和 Watchkit 版本可以使用不同的版本。然而,当我添加:

编译器发出错误信号:

'WKInterfaceLabel' 仅适用于 iOS 8.2 或更高版本。

如果我想将应用程序扩展到手表,是否需要我需要放弃对 iOS 7 的支持,或者有没有出路?

0 投票
1 回答
505 浏览

swift - 在 WKInterfaceTable 行中放置一个图像和两个标签

我正在为我的应用程序构建一个手表套件扩展,其中包括WKInterfaceTable. 现在我想在行中添加一个 detailTextLabel 并将其放在主标签下。我不知道为什么,但我只能将它拖到主标签旁边,而不是在主标签下。有人知道为什么以及如何解决它吗?我只想在 iOS 应用程序中显示一个 detailTextLabel。谢谢你的支持!

0 投票
1 回答
555 浏览

watchkit - WatchOS2 - 有没有办法水平滚动标签?

我想知道(希望)有一种方法可以水平滚动 WKInterfaceLabel 吗?

0 投票
1 回答
714 浏览

xcode - Apple Watch:如何在基线处对齐两个不同字体大小的标签?

在 Apple Watch 上,如何在基线处对齐两个不同字体大小的标签?

查看红色和蓝色标签,它们未在基线对齐。

在基线对齐 在基线对齐

这是界面构建器中第一个图像的结构:

这是界面构建器中第二个图像的结构:

在第一张图片中,带有小字体的标签太高了,在第二张图片中,带有小字体的标签有点太低了。

我怎样才能让它们在基线上完全对齐?

0 投票
0 回答
101 浏览

ios - WatchKit 无法设置 Label 标题

我试图以编程方式设置 WKInterfaceLabel 标题,但是它没有改变。

无法使用此设置标题,

也尝试过属性字符串,