Separate Simulator enum #2

Closed
opened 2015-11-22 12:41:19 +00:00 by JulesMoorhouse · 6 comments
JulesMoorhouse commented 2015-11-22 12:41:19 +00:00 (Migrated from github.com)

It would be awesome the device model could be returned from the simulator rather that iPadSimulator etc.

It would be awesome the device model could be returned from the simulator rather that iPadSimulator etc.
giuseppenucifora commented 2015-11-22 16:04:12 +00:00 (Migrated from github.com)

You wish you could understand if the simulator is a specific device?

Thx
Giuseppe

You wish you could understand if the simulator is a specific device? Thx Giuseppe
JulesMoorhouse commented 2015-11-22 16:09:59 +00:00 (Migrated from github.com)

No, I want to know which device is being simulated using the existing device values.

Basically I want to write code for a specific device and see the results in the simulator. Getting a device type of simulator doesn't help me.

Thanks for your help.

No, I want to know which device is being simulated using the existing device values. Basically I want to write code for a specific device and see the results in the simulator. Getting a device type of simulator doesn't help me. Thanks for your help.
giuseppenucifora commented 2015-11-22 17:50:23 +00:00 (Migrated from github.com)

If you want to distinguish between different devices when you use simulator you can use UIDeviceModelInches enum to get different size of screen. There isn't a method to know perfectly which device the simulator run.

You might try something like this :

switch ([[UIDevice currentDevice] deviceFamily]) {
        case UIDeviceFamilyiPhone:
        case UIDeviceFamilyiPod: {

            switch ([[UIDevice currentDevice] deviceInches]) {
                case UIDeviceModelInches35: {

                    break;
                }
                case UIDeviceModelInches4: {

                    break;
                }
                case UIDeviceModelInches47: {

                    break;
                }
                case UIDeviceModelInches55: {

                    break;
                }
                case UIDeviceModelInchesUnKnown:
                default: {
                    break;
                }
            }
            break;
        }
        case UIDeviceFamilyiPad: {
            switch ([[UIDevice currentDevice] deviceInches]) {

                case UIDeviceModelInches79: {

                    break;
                }
                case UIDeviceModelInches97: {

                    break;
                }
                case UIDeviceModelInches129: {

                    break;
                }
                case UIDeviceModelInchesUnKnown:
                default: {
                    break;
                }
            }
            break;
        }
        default: {
            break;
        }
    }
If you want to distinguish between different devices when you use simulator you can use UIDeviceModelInches enum to get different size of screen. There isn't a method to know perfectly which device the simulator run. You might try something like this : ``` objc switch ([[UIDevice currentDevice] deviceFamily]) { case UIDeviceFamilyiPhone: case UIDeviceFamilyiPod: { switch ([[UIDevice currentDevice] deviceInches]) { case UIDeviceModelInches35: { break; } case UIDeviceModelInches4: { break; } case UIDeviceModelInches47: { break; } case UIDeviceModelInches55: { break; } case UIDeviceModelInchesUnKnown: default: { break; } } break; } case UIDeviceFamilyiPad: { switch ([[UIDevice currentDevice] deviceInches]) { case UIDeviceModelInches79: { break; } case UIDeviceModelInches97: { break; } case UIDeviceModelInches129: { break; } case UIDeviceModelInchesUnKnown: default: { break; } } break; } default: { break; } } ```
JulesMoorhouse commented 2015-11-22 18:40:33 +00:00 (Migrated from github.com)

Oh right, is that part of your library?

Oh right, is that part of your library?
giuseppenucifora commented 2015-11-22 18:58:51 +00:00 (Migrated from github.com)

Yes, you can copy and paste the code :)

Yes, you can copy and paste the code :)
JulesMoorhouse commented 2015-11-25 13:35:24 +00:00 (Migrated from github.com)

Hi,

If your using the simulator UIDeviceModelInches129 is never reached, UIDeviceModelInchesUnKnown is returned.

I can see that the x86_64 derived and condition is reached that determines if its a small screen or big screen.

Can this be improved in anyway?

I'm not likely to have any access to an iPad pro and I will have rely on the simulator.

Thanks in advance.

Hi, If your using the simulator UIDeviceModelInches129 is never reached, UIDeviceModelInchesUnKnown is returned. I can see that the x86_64 derived and condition is reached that determines if its a small screen or big screen. Can this be improved in anyway? I'm not likely to have any access to an iPad pro and I will have rely on the simulator. Thanks in advance.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: giuseppenuc/UIDevice-Utils#2
No description provided.