【发布时间】:2017-07-14 14:13:48
【问题描述】:
我正在尝试实现左右滑动手势来更改我的 UIView 上的图像。
我做了以下事情:
if art_title.text == "Art Collection" {
var imageList = ["Boulder Bean","Mother of Earth","Bamboozled","Black Figures","Modest Angel"]
var index = 0
func leftSwipe(_ sender: UISwipeGestureRecognizer) {
if index < imageList.count - 1 {
index = index + 1
art_image.image = UIImage(named: imageList[index])
}
}
func rightSwipe(_ sender: UISwipeGestureRecognizer) {
if index > 0 {
index = index - 1
art_image.image = UIImage(named: imageList[index])
}
}
}
当我尝试在任何注释上滑动时,我现在遇到了崩溃。
【问题讨论】:
标签: ios swift uiview uiswipegesturerecognizer