We are getting a black strip in iphone camera . We tried zooming preview overlay of camera by using previewTransform and works in iPhone 7 but not in iPhoneX . Please let us know if any one does have a solution?

This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal.

Hi,

For iPhone X , we need to use the different scale value to avoid the black strip from the camera. Check the below code snippet.

var cameraOptions1={hideControlBar:true};

formName.CameraID.cameraOptions =cameraOptions1;

var transform = kony.ui.makeAffineTransform();

transform.scale(3.8, 3.8);

formName.CameraID.previewTransform = transform;

Hi, does this also apply for newer models iphone XR, XS etc.?

And do we have to identify them like so:

kony.string.startsWith(kony.os.deviceInfo().model, "iPhone X") === true

??

Mmm, I just applied this trick but now the camera is extremely zoomed in, this is not what one should want.

Hello @Emewson Pvwkew​

We have cross checked the behaviour in native and identified that the behaviour is expected behaviour. If you have UIImagePickerController and apply transform on the UIImagePickerController it will zoomed and the cropped image will be different.

Hello @Emewson Pvwkew​

Yes, the above mentioned code will applicable for the new models. We have to identify the device model and set the code. OR you can use the below code to to fix for all the iPhone devices.

var deviceInfo=kony.os.deviceInfo();

var deviceWidth=deviceInfo.screenWidth;

var deviceHeight=deviceInfo.screenHeight;

var cameraAspectRatio=4.0/3.0;

var cameraHeight=deviceWidth*cameraAspectRatio;

var transform = kony.ui.makeAffineTransform();

transform.translate(0, (deviceHeight-cameraHeight)/2);

form.camOverlay.previewTransform = transform;

This puts the camera in the middle, that's good. I got it to work now. Thank you.

Hi @Twvcey Rvndvll​ ,

This puts the camera in the middle, that's good. I got it to work now. Thank you.

Hello @Emewson Pvwkew​

Did my response help you? If yes, make sure you click [Select as Best] under the response to close the post.

It sure did. But i can't set the answer as best, because the question was not originally mine I think.