14 Replies
      Latest reply on Dec 13, 2016 10:42 AM by pekingese1990
      rranjan@apple Level 1 Level 1 (0 points)

        I have been using below code to scale my UIImagePickerController's live preview to fill the entire screen (because aspect ratio of camera preview and main screen are different). This worked perfectly till now.

         

        CGSize screenSize = [[UIScreen mainScreen] bounds].size; 
        float screenHeight= MAX(screenSize.height, screenSize.width); 
        float screenWidth= MIN(screenSize.height, screenSize.width); 
        float cameraAspectRatio = 4.0 / 3.0; 
        float imageWidth = floorf(screenWidth * cameraAspectRatio); 
        float scale = ceilf((screenHeight / imageWidth) * 10.0) / 10.0; 
        objImagePickerController.cameraViewTransform = CGAffineTransformMakeTranslation(0, (screenHeight - imageWidth) / 2.0); 
        objImagePickerController.cameraViewTransform= CGAffineTransformMakeScale(scale, scale);
        

         

        I installed iOS 10 beta 7 on an iPhone 5 and it doesn't scale. I can see black patch at the bottom of UIImagePickerController's view. Seems like CGAffineTransformMakeScale isn't working properly here.

         

        Did anybody else face this issue? This is short of weird behavior appearing in iOS 10 beta OS. I am unable to find a workaround for this. Please advise.

        NOTE:: objImagePickerController is an instance of UIImagePickerController.