【问题标题】:Coordinates of Buttons in SwiftSwift中按钮的坐标
【发布时间】:2014-09-22 11:59:44
【问题描述】:

我对 swift 和编程相当陌生,并且有一个非常简单的问题。 我在 UI 中有四个带有自定义图像的按钮,我试图在按下的按钮后面放置一个周围的图形。这是代码行:

@IBAction func moodButton(sender: AnyObject) {

    timerSelection.center = CGPointMake(moodButton.center.x, moodButton.center.y)

}

timerSelectionUIImageView 我试图将其置于所选按钮的坐标...

请帮忙! & 提前致谢:)

【问题讨论】:

    标签: ios swift uiimageview uibutton coordinates


    【解决方案1】:

    试试这样的:

    @IBAction func moodButton(sender: UIButton) {
        timerSelection.center = sender.center
    }
    

    您可以将此子视图发送回之前:

    view.sendSubviewToBack(timerSelection)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-17
      相关资源
      最近更新 更多