Swift中按钮的坐标

时间:2014-09-22 11:59:45

标签: ios swift uiimageview uibutton coordinates

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

@IBAction func moodButton(sender: AnyObject) {

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

}

timerSelectionUIImageView我试图放入所选按钮的坐标...

请帮忙! &安培;在此先感谢:)

1 个答案:

答案 0 :(得分:0)

尝试这样的事情:

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

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

view.sendSubviewToBack(timerSelection)