我試圖使用UIScrollview
實現圖像縮放功能。在那裏我保持形象的方面適合。
圖像在UIScrollView
之內,並且圖像幀已被給出類似於UIScrollView
。
這是我的代碼。在UIScrollview上縮放圖像後,它滾動到圖像區域外
class CroppingImageViewController: UIViewController, UIScrollViewDelegate{
var image:UIImage = UIImage()
@IBOutlet var imageview:UIImageView!
@IBOutlet var scrollview:UIScrollView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
imageview.image = image
scrollview.contentSize = imageview.frame.size;
scrollview.minimumZoomScale = 1.0;
scrollview.maximumZoomScale = 4.0;
scrollview.setZoomScale(scrollview.minimumZoomScale, animated: true)
scrollview.delegate = self;
}
func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView? {
return imageview
}
}
What's actually happening
What required
我的要求是,圖像應被向上捲動到它的內容。
它仍然是一樣的。沒有運氣 !! – abhinavroy23