0

I got this bigger UIview(ex: 200x200) which needs to be fit inside ScrollView(100x100), i want to ZoomOut the Uiview for the size of scroll view and display it during initial load.

iHarsha
  • 9
  • 2

1 Answers1

0
    var aspectCalX = self.view.frame.width(this is smaller View) / a4view.frame.width(this is bigger View)
    var aspectCalY = self.view.frame.height(this is smaller view) / a4view.frame.height(this is bigger view)

    biggerview.autoresizesSubviews = true

    biggerview.transform = CGAffineTransform(scaleX: aspectCalX, y: aspectCalY)
    biggerview.frame = CGRect(x: 0.0, y: 0.0, width: a4view.frame.width, height: a4view.frame.height)       
    smallerView.addSubview(biggerview)
iHarsha
  • 9
  • 2