iPhone XR returns correct nativeBounds but has wrong screen size on device
My project target iOS - 11 and later. It has correct Launch images assets for XR and XS Max with appropriate dimensions. On simulator my app works as expected on both XR and XS Max.
But, users reported UI issues on real devices. After some research it looks like on real device this
[UIScreen mainScreen].nativeBounds.size
returns correct values. But seems like device itself think that it has iPhone X screen size (like when i do not use correct launch screen images). And in my opinion it returns wrong values with
[UIScreen mainScreen].bounds.size
this one i believe returns values like it's not iPhone XR but iPhone X.
Did someone face such an issue too?
ios objective-c iphone ios12
add a comment |
My project target iOS - 11 and later. It has correct Launch images assets for XR and XS Max with appropriate dimensions. On simulator my app works as expected on both XR and XS Max.
But, users reported UI issues on real devices. After some research it looks like on real device this
[UIScreen mainScreen].nativeBounds.size
returns correct values. But seems like device itself think that it has iPhone X screen size (like when i do not use correct launch screen images). And in my opinion it returns wrong values with
[UIScreen mainScreen].bounds.size
this one i believe returns values like it's not iPhone XR but iPhone X.
Did someone face such an issue too?
ios objective-c iphone ios12
You better add some code. Then we might understand what you mean by wrong bounds and real wrong bounds and nativeBounds.
– Codo
Nov 12 '18 at 17:28
Fixed question a bit. I believe it should be easier to understand now.
– Vlad Polyanskiy
Nov 12 '18 at 18:15
1
You talk about correct and wrong values. You better specify what values you expect and what values you get. Otherwise the question is still too vague.
– Codo
Nov 12 '18 at 19:44
And by the way: to what value have you set the Base SDK in your project?
– Codo
Nov 12 '18 at 19:45
add a comment |
My project target iOS - 11 and later. It has correct Launch images assets for XR and XS Max with appropriate dimensions. On simulator my app works as expected on both XR and XS Max.
But, users reported UI issues on real devices. After some research it looks like on real device this
[UIScreen mainScreen].nativeBounds.size
returns correct values. But seems like device itself think that it has iPhone X screen size (like when i do not use correct launch screen images). And in my opinion it returns wrong values with
[UIScreen mainScreen].bounds.size
this one i believe returns values like it's not iPhone XR but iPhone X.
Did someone face such an issue too?
ios objective-c iphone ios12
My project target iOS - 11 and later. It has correct Launch images assets for XR and XS Max with appropriate dimensions. On simulator my app works as expected on both XR and XS Max.
But, users reported UI issues on real devices. After some research it looks like on real device this
[UIScreen mainScreen].nativeBounds.size
returns correct values. But seems like device itself think that it has iPhone X screen size (like when i do not use correct launch screen images). And in my opinion it returns wrong values with
[UIScreen mainScreen].bounds.size
this one i believe returns values like it's not iPhone XR but iPhone X.
Did someone face such an issue too?
ios objective-c iphone ios12
ios objective-c iphone ios12
edited Nov 12 '18 at 18:14
Vlad Polyanskiy
asked Nov 12 '18 at 14:53
Vlad PolyanskiyVlad Polyanskiy
1,42411221
1,42411221
You better add some code. Then we might understand what you mean by wrong bounds and real wrong bounds and nativeBounds.
– Codo
Nov 12 '18 at 17:28
Fixed question a bit. I believe it should be easier to understand now.
– Vlad Polyanskiy
Nov 12 '18 at 18:15
1
You talk about correct and wrong values. You better specify what values you expect and what values you get. Otherwise the question is still too vague.
– Codo
Nov 12 '18 at 19:44
And by the way: to what value have you set the Base SDK in your project?
– Codo
Nov 12 '18 at 19:45
add a comment |
You better add some code. Then we might understand what you mean by wrong bounds and real wrong bounds and nativeBounds.
– Codo
Nov 12 '18 at 17:28
Fixed question a bit. I believe it should be easier to understand now.
– Vlad Polyanskiy
Nov 12 '18 at 18:15
1
You talk about correct and wrong values. You better specify what values you expect and what values you get. Otherwise the question is still too vague.
– Codo
Nov 12 '18 at 19:44
And by the way: to what value have you set the Base SDK in your project?
– Codo
Nov 12 '18 at 19:45
You better add some code. Then we might understand what you mean by wrong bounds and real wrong bounds and nativeBounds.
– Codo
Nov 12 '18 at 17:28
You better add some code. Then we might understand what you mean by wrong bounds and real wrong bounds and nativeBounds.
– Codo
Nov 12 '18 at 17:28
Fixed question a bit. I believe it should be easier to understand now.
– Vlad Polyanskiy
Nov 12 '18 at 18:15
Fixed question a bit. I believe it should be easier to understand now.
– Vlad Polyanskiy
Nov 12 '18 at 18:15
1
1
You talk about correct and wrong values. You better specify what values you expect and what values you get. Otherwise the question is still too vague.
– Codo
Nov 12 '18 at 19:44
You talk about correct and wrong values. You better specify what values you expect and what values you get. Otherwise the question is still too vague.
– Codo
Nov 12 '18 at 19:44
And by the way: to what value have you set the Base SDK in your project?
– Codo
Nov 12 '18 at 19:45
And by the way: to what value have you set the Base SDK in your project?
– Codo
Nov 12 '18 at 19:45
add a comment |
3 Answers
3
active
oldest
votes
I faced the same question, and I found the reason. You could check the LaunchImage in the assets. Is there an image for the iPhone XR. If you don't have the iPhone XR LaunchImage, the screen size of XR will compute with the the iPhone X. So make a LaunchImage for XR.
Hope this helps.
Please read question carefully. It has correct launch images.
– Vlad Polyanskiy
Nov 30 '18 at 10:44
add a comment |
The iPhone XR does not use the same size in (virtual) points than the iPhone X or iPhone XS does. It uses the same point dimensions like the new iPhone XS Max, but is rendered only with @2x
instead of @3x
, like the Max does (lower pixel per inch density). You can read more about screen sizes, points, rendered dimensions etc. for each iPhone model here.
The missing templates for launch images in XCAssets also affect the new generation of iPads, as e.g. the new iPad Pro 11" slightly differs from the standard 3/4 aspect ratio, the other iPads have. Diving deeper into the missing templates issue brought me to this radar post from 2015 about missing iPad Pro App Icon and Launch Image templates, where the comment states:
[...] and Developer relations reported in a radar comment that they no longer support launch images and will not be adding the iPad pro launch image size to asset catalogs.
It seems like Apple is discouraging the use of launch images inside XCAssets and proposes to use Launch Screen.storyboard
instead. It will "auto-size" to the correct dimensions (and respectively the outputs of UIScreen.main.bounds
and UIScreen.main.nativeBounds
) depending on the used device or simulator.
Interesting info, thanks. But in my case the trouble was in a specific user device settings. See my answer below.
– Vlad Polyanskiy
Nov 30 '18 at 10:49
add a comment |
In my case the trouble was in the specific user device settings.
Settings -> Display & brightness -> Display zoom switch to ON.
This cause to return wrong
[UIScreen mainScreen].bounds.size
values runtime
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53264692%2fiphone-xr-returns-correct-nativebounds-but-has-wrong-screen-size-on-device%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I faced the same question, and I found the reason. You could check the LaunchImage in the assets. Is there an image for the iPhone XR. If you don't have the iPhone XR LaunchImage, the screen size of XR will compute with the the iPhone X. So make a LaunchImage for XR.
Hope this helps.
Please read question carefully. It has correct launch images.
– Vlad Polyanskiy
Nov 30 '18 at 10:44
add a comment |
I faced the same question, and I found the reason. You could check the LaunchImage in the assets. Is there an image for the iPhone XR. If you don't have the iPhone XR LaunchImage, the screen size of XR will compute with the the iPhone X. So make a LaunchImage for XR.
Hope this helps.
Please read question carefully. It has correct launch images.
– Vlad Polyanskiy
Nov 30 '18 at 10:44
add a comment |
I faced the same question, and I found the reason. You could check the LaunchImage in the assets. Is there an image for the iPhone XR. If you don't have the iPhone XR LaunchImage, the screen size of XR will compute with the the iPhone X. So make a LaunchImage for XR.
Hope this helps.
I faced the same question, and I found the reason. You could check the LaunchImage in the assets. Is there an image for the iPhone XR. If you don't have the iPhone XR LaunchImage, the screen size of XR will compute with the the iPhone X. So make a LaunchImage for XR.
Hope this helps.
answered Nov 19 '18 at 8:33
iNerviNerv
1
1
Please read question carefully. It has correct launch images.
– Vlad Polyanskiy
Nov 30 '18 at 10:44
add a comment |
Please read question carefully. It has correct launch images.
– Vlad Polyanskiy
Nov 30 '18 at 10:44
Please read question carefully. It has correct launch images.
– Vlad Polyanskiy
Nov 30 '18 at 10:44
Please read question carefully. It has correct launch images.
– Vlad Polyanskiy
Nov 30 '18 at 10:44
add a comment |
The iPhone XR does not use the same size in (virtual) points than the iPhone X or iPhone XS does. It uses the same point dimensions like the new iPhone XS Max, but is rendered only with @2x
instead of @3x
, like the Max does (lower pixel per inch density). You can read more about screen sizes, points, rendered dimensions etc. for each iPhone model here.
The missing templates for launch images in XCAssets also affect the new generation of iPads, as e.g. the new iPad Pro 11" slightly differs from the standard 3/4 aspect ratio, the other iPads have. Diving deeper into the missing templates issue brought me to this radar post from 2015 about missing iPad Pro App Icon and Launch Image templates, where the comment states:
[...] and Developer relations reported in a radar comment that they no longer support launch images and will not be adding the iPad pro launch image size to asset catalogs.
It seems like Apple is discouraging the use of launch images inside XCAssets and proposes to use Launch Screen.storyboard
instead. It will "auto-size" to the correct dimensions (and respectively the outputs of UIScreen.main.bounds
and UIScreen.main.nativeBounds
) depending on the used device or simulator.
Interesting info, thanks. But in my case the trouble was in a specific user device settings. See my answer below.
– Vlad Polyanskiy
Nov 30 '18 at 10:49
add a comment |
The iPhone XR does not use the same size in (virtual) points than the iPhone X or iPhone XS does. It uses the same point dimensions like the new iPhone XS Max, but is rendered only with @2x
instead of @3x
, like the Max does (lower pixel per inch density). You can read more about screen sizes, points, rendered dimensions etc. for each iPhone model here.
The missing templates for launch images in XCAssets also affect the new generation of iPads, as e.g. the new iPad Pro 11" slightly differs from the standard 3/4 aspect ratio, the other iPads have. Diving deeper into the missing templates issue brought me to this radar post from 2015 about missing iPad Pro App Icon and Launch Image templates, where the comment states:
[...] and Developer relations reported in a radar comment that they no longer support launch images and will not be adding the iPad pro launch image size to asset catalogs.
It seems like Apple is discouraging the use of launch images inside XCAssets and proposes to use Launch Screen.storyboard
instead. It will "auto-size" to the correct dimensions (and respectively the outputs of UIScreen.main.bounds
and UIScreen.main.nativeBounds
) depending on the used device or simulator.
Interesting info, thanks. But in my case the trouble was in a specific user device settings. See my answer below.
– Vlad Polyanskiy
Nov 30 '18 at 10:49
add a comment |
The iPhone XR does not use the same size in (virtual) points than the iPhone X or iPhone XS does. It uses the same point dimensions like the new iPhone XS Max, but is rendered only with @2x
instead of @3x
, like the Max does (lower pixel per inch density). You can read more about screen sizes, points, rendered dimensions etc. for each iPhone model here.
The missing templates for launch images in XCAssets also affect the new generation of iPads, as e.g. the new iPad Pro 11" slightly differs from the standard 3/4 aspect ratio, the other iPads have. Diving deeper into the missing templates issue brought me to this radar post from 2015 about missing iPad Pro App Icon and Launch Image templates, where the comment states:
[...] and Developer relations reported in a radar comment that they no longer support launch images and will not be adding the iPad pro launch image size to asset catalogs.
It seems like Apple is discouraging the use of launch images inside XCAssets and proposes to use Launch Screen.storyboard
instead. It will "auto-size" to the correct dimensions (and respectively the outputs of UIScreen.main.bounds
and UIScreen.main.nativeBounds
) depending on the used device or simulator.
The iPhone XR does not use the same size in (virtual) points than the iPhone X or iPhone XS does. It uses the same point dimensions like the new iPhone XS Max, but is rendered only with @2x
instead of @3x
, like the Max does (lower pixel per inch density). You can read more about screen sizes, points, rendered dimensions etc. for each iPhone model here.
The missing templates for launch images in XCAssets also affect the new generation of iPads, as e.g. the new iPad Pro 11" slightly differs from the standard 3/4 aspect ratio, the other iPads have. Diving deeper into the missing templates issue brought me to this radar post from 2015 about missing iPad Pro App Icon and Launch Image templates, where the comment states:
[...] and Developer relations reported in a radar comment that they no longer support launch images and will not be adding the iPad pro launch image size to asset catalogs.
It seems like Apple is discouraging the use of launch images inside XCAssets and proposes to use Launch Screen.storyboard
instead. It will "auto-size" to the correct dimensions (and respectively the outputs of UIScreen.main.bounds
and UIScreen.main.nativeBounds
) depending on the used device or simulator.
answered Nov 19 '18 at 9:12
Rainer SchwarzRainer Schwarz
1666
1666
Interesting info, thanks. But in my case the trouble was in a specific user device settings. See my answer below.
– Vlad Polyanskiy
Nov 30 '18 at 10:49
add a comment |
Interesting info, thanks. But in my case the trouble was in a specific user device settings. See my answer below.
– Vlad Polyanskiy
Nov 30 '18 at 10:49
Interesting info, thanks. But in my case the trouble was in a specific user device settings. See my answer below.
– Vlad Polyanskiy
Nov 30 '18 at 10:49
Interesting info, thanks. But in my case the trouble was in a specific user device settings. See my answer below.
– Vlad Polyanskiy
Nov 30 '18 at 10:49
add a comment |
In my case the trouble was in the specific user device settings.
Settings -> Display & brightness -> Display zoom switch to ON.
This cause to return wrong
[UIScreen mainScreen].bounds.size
values runtime
add a comment |
In my case the trouble was in the specific user device settings.
Settings -> Display & brightness -> Display zoom switch to ON.
This cause to return wrong
[UIScreen mainScreen].bounds.size
values runtime
add a comment |
In my case the trouble was in the specific user device settings.
Settings -> Display & brightness -> Display zoom switch to ON.
This cause to return wrong
[UIScreen mainScreen].bounds.size
values runtime
In my case the trouble was in the specific user device settings.
Settings -> Display & brightness -> Display zoom switch to ON.
This cause to return wrong
[UIScreen mainScreen].bounds.size
values runtime
answered Nov 30 '18 at 10:48
Vlad PolyanskiyVlad Polyanskiy
1,42411221
1,42411221
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53264692%2fiphone-xr-returns-correct-nativebounds-but-has-wrong-screen-size-on-device%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You better add some code. Then we might understand what you mean by wrong bounds and real wrong bounds and nativeBounds.
– Codo
Nov 12 '18 at 17:28
Fixed question a bit. I believe it should be easier to understand now.
– Vlad Polyanskiy
Nov 12 '18 at 18:15
1
You talk about correct and wrong values. You better specify what values you expect and what values you get. Otherwise the question is still too vague.
– Codo
Nov 12 '18 at 19:44
And by the way: to what value have you set the Base SDK in your project?
– Codo
Nov 12 '18 at 19:45