Saturday, November 21, 2026
HomeiOS Developmentios - bounds/scale versus nativeBounds/nativeScale wrt contact photographs and the decision display...

ios – bounds/scale versus nativeBounds/nativeScale wrt contact photographs and the decision display screen

[ad_1]

I need to programmatically add a picture to a contact which can show on the decision display screen when there’s an incoming name.

I used UIScreen.foremost.bounds and used that as the dimensions of for a picture I generate utilizing UIGraphicsImageRenderer(). Nevertheless when this will get displayed on the decision display screen all of the placements are off.

So I took a screenshot of the iPhone desktop and added that to a contact and that shows superb on the decision display screen, then I seemed on the dimension of the picture and its associated to the nativeBounds/nativeScale. Here is some numbers:

For my telephone bounds is (0.0, 0.0, 375.0, 812.0) with a scale of three.0
and the nativeBounds is (0.0, 0.0, 1080.0, 2340.0) with a scale of two.88.

The dimensions of the picture of the screenshot which was added to contacts is 1125 by 2436 pixels.
This dimension is ((nativeBounds / nativeScale) * scale) i.e. ((1080 / 2.88) * 3) = 1125

I have been attempting to learn up on sure/scale versus nativeBounds/nativeScale however do not fairly perceive their relationship generally, however particularly in relationship to the contacts picture. Why is the picture that will get added to contacts this dimension of 1125 by 2436?

If I exploit the method ((nativeBounds / nativeScale) * scale) to calculate the sizes of my picture are there any gotcha’s that may hit me when the code is run on each gadget dimension, or ought to or not it’s okay?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments