所以我有一个scrollView和一个图像视图里面,一切都很好(滚动),直到我尝试捏缩放时,整个图片只是跳到向下和向左,并保持相同的大小,但当我举起手指scrollView只是冻结,即使滚动停止工作。这是代码:
class ScrollViewViewController: ViewController, UIScrollViewDelegate {
@IBOutlet weak var scrollView: UIScrollView!
var imageView = UIImageView()
var image = UIImage() {
didSet {imageView.image = image}
}
override func viewDidLoad() {
super.viewDidLoad()
let imageView = UIImageView(image: image)
imageView.frame = CGRect(origin: CGPointZero, size: image.size)
scrollView?.addSubview(imageView)
scrollView?.contentSize = imageView.frame.size
scrollView?.delegate = self
scrollView?.minimumZoomScale = 0.5
scrollView?.maximumZoomScale = 2
}
func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView? {
return imageView
}
}
有人发现任何潜在的问题吗?