【发布时间】:2015-11-18 01:03:12
【问题描述】:
我正在制作一个单视图应用程序,我希望 UI 图像从屏幕的一侧移动到另一侧。我想检测此图像上的触摸。我无法使用按钮,因为我无法使按钮移动。更精确:当我单击 UI 图像时,我希望显示一个标签并且不再隐藏。我不能使用 UI 按钮,因为当我单击图像时,图像会移动,按钮无法移动。我希望这更清楚。 这是到目前为止的代码:
@IBAction func Start1(sender: UIButton) {
Person1.center = CGPointMake(160, 450) ;
[UIView.animateWithDuration(3,
animations: { self.Person1.center = CGPointMake(160, 70 )
})];
}
@IBOutlet var Person1: UIImageView!
谢谢
【问题讨论】:
-
stackoverflow.com/questions/19611601/… 答案在objective-c中,但从我所见的swift来看,方法是一样的。只需转换语法。
-
为什么按钮不能动?
标签: ios swift uiimageview touch