The question is what do you want to have as a result. CGAffineTransformMakeScale (1.0,1.0) is the default scale - so it does not make any changes. The camera on all apple devices has a 4: 3 aspect ratio. In addition, I have to admit that viewing the camera by default has a size equal to the width of the screen with height, which leads to 4: 3 advancement - thatβs why you always have different views on the camera .
If you want to look like a camera with a height equal to the height of the screen, you need to do some affine transformation. Here is an example:
CGFloat cameraAspectRation = 4.0/3.0; CGFloat cameraViewStarterHeight = screenSize.width*cameraAspectRation; CGFloat cameraAdjustedYPosition = (screenSize.height - cameraViewStarterHeight)/2 - 20; CGFloat cameraScaleTransformCoef = screenSize.height/cameraViewStarterHeight; CGAffineTransform adjustedYPositionTransform = CGAffineTransformMakeTranslation(0, cameraAdjustedYPosition); CGAffineTransform adjustedScaleTransform = CGAffineTransformMakeScale(cameraScaleTransformCoef, cameraScaleTransformCoef); self.cameraViewTransform = CGAffineTransformConcat(adjustedYPositionTransform, adjustedScaleTransform);
But in this way, as you saw, the camera view will be "enlarged." Hope this helps you understand what you have.
source share