UIScrollView无法以纵向或横向模式显示图像

我创建了一个风景画板中的风景导向的VC

我已经在其中添加了一个UIIScrollView ,比如说:在UIIScrollView中有UIIScrollView (h)。

我想做什么:

1)在ScrollView滚动图像(高分辨率,如1334 x 750)
2)以横向模式在ScrollView中查看图像


To make ScrollView to display the image, I have to do it in `viewDidAppear` 

but here the Problems:

1) The Width and height of the `ScrollView` is gone
2) label on top gone.
3) The `ScrollView` Size become small something like 200 x 150 and start from the Top corner like (0,0)
What I need to do to make `scrollview` size like before 1000 x 500? --- Update --
class ViewController: UIViewController, UIScrollViewDelegate { @IBOutlet weak var myUIScrollView: UIScrollView! var imgView: UIImageView! override func viewDidLoad() { super.viewDidLoad() //-- force to landscape mode: let value = UIInterfaceOrientation.LandscapeLeft.rawValue UIDevice.currentDevice().setValue(value, forKey: "orientation") self.myUIScrollView.maximumZoomScale = 10.0 self.myUIScrollView.minimumZoomScale = 1.0 self.myUIScrollView.delegate = self imgView = UIImageView(image: UIImage(named: "MyPhoto.png")) } override func viewDidAppear(animated: Bool) { self.myUIScrollView.contentSize = imgView.bounds.size self.myUIScrollView.addSubview(imgView) view.addSubview(myUIScollView) } override func shouldAutorotate() -> Bool { return true } func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView? { return imgView }
链接地址: http://www.djcxy.com/p/74273.html

上一篇: UIScrollView cannot display image either in Portrait or Landscape mode

下一篇: UIView ignoring size constraints when AVCaptureVideoPreviewLayer subview added