ios - WatchKit - 如何移动标签或图像

标签 ios swift watchkit

我在 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/

相关文章:

IOS/objective-C : Search string element with array of objects

ios - 快速获取所选 View 的索引时出现问题

swift - 使用 segue 打开其他 View 只能通过按下按钮来实现

ios - Rx swift : Two way binding

swift - NSUserDefaultsApp 组 WatchKit swift

ios - 在 iOS 中编辑 URL 字符串

ios resignFirstResponder 重置动画

ios - UIDatePicker - DateFormatter 在选择器中选择的那一天后返回

ios - WatchKit:捆绑标识符和 WKAppBundleIdentifer 之间有什么区别?为什么它会导致应用程序组无法工作?

ios - TableView 中的多个 RowType - watchKit