我在 interface.storyboard 中添加了标签、图像和按钮。单击按钮时如何将标签和图像移动到新位置>
@IBOutlet weak var labelMove: WKInterfaceLabel!
@IBOutlet weak var image1: WKInterfaceImage!
@IBOutlet weak var buttonTest: WKInterfaceButton!
@IBAction func buttonClick() {
image1. ???? // Tried image1.center and image1.frame
}
如果尝试过 image1.center 和 image1.frame 但都没有在 WatchKit 上工作。
最佳答案
在接口(interface) Controller 中(截至目前)可以对对象执行的操作有限制。
在 runtime 支持以下提到的操作
- 设置或更新数据值。
- 更改支持此类修改的对象的视觉外观。
- 更改对象的大小。
- 更改对象的透明度。
- 显示或隐藏对象。
You cannot add new objects to your interface or change the order of the objects that are already there.
我想这排除了移动帧(这也不可用)。
关于ios - WatchKit - 如何移动标签或图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27082500/