I have each of those images set in an array that calls out to Firebase for the image. I was wondering if I could have a separate array to call from for different sized iPhones because the iPhone X screen size cuts some of the text off. I want to resize the images for just the iPhone X. Is there a way to see what device the user has and then if it is the iPhone X it would show array1, and if was anything else it would show array2. I have tried looking at this post however what they did is too complicated and not what I am looking for. What I am trying to do I know is very simple. I am just not sure the direct code for it. I just need to know if it's an iPhone X then switch to array1, otherwise I don't care which device it is wether it's an iPad with cellular or wifi. Just check if the device is an iPhone X otherwise just keep everything the same.
Asked
Active
Viewed 66 times
-2
-
Possible duplicate of [How to get device make and model on iOS?](https://stackoverflow.com/questions/11197509/how-to-get-device-make-and-model-on-ios) – brandonscript Oct 13 '17 at 04:47
-
This is not a duplicate. I have just cleared up my question incase that helps you better understand it. Thank you – Jaqueline Oct 13 '17 at 05:03
-
Possible duplicate of [Detect if the device is iPhone X](https://stackoverflow.com/questions/46192280/detect-if-the-device-is-iphone-x). – Martin R Oct 13 '17 at 05:35
-
The concept is the same. Check the device model and do what you need to do. Definitely a duplicate, sorry! – brandonscript Oct 13 '17 at 06:12
-
How if it is not what I am looking for? How many times do I have to say that? – Jaqueline Oct 13 '17 at 06:20
1 Answers
1
I don't think that you should know about a model of a iPhone.
You should know about a screen/view ratio (width / height).
Ratio is a main reason to decide what images you should use.
You can find screen ratio with bounds property, for example:
if (CGRectGetWidth([UIScreen mainScreen].bounds) / CGRectGetHeight([UIScreen mainScreen].bounds) <= GOOD_VALUE){
//use one
}
else
{
//use other
}
Also screen has a property scale, that will be very useful for you.

Andrew Romanov
- 4,774
- 3
- 25
- 40
-
Thank you so much for this! I will check this out tomorrow as it is getting late here, and will get bak to you tomorrow. – Jaqueline Oct 13 '17 at 05:44
-
-
Rather than the <= GOOD_VALUE, is that where I would put in the screen ratio value or what value do I put there? Thank you so much for helping me! – Jaqueline Oct 13 '17 at 16:49
-
I changed it to: let screenSize = UIScreen.main.bounds let screenWidth = screenSize.width let screenHeight = screenSize.height if screenWidth / screenHeight == 125/2436 ... – Jaqueline Oct 13 '17 at 17:15