Q:

Is it okay to use this code to detect the iPhone screen size?

I know it's not a great idea to alter an app based on the screen size but I am trying to modify the camera and use a custom overlay image so I need to know the screen size. There are a bunch of solutions to detecting the screen size using macros etc I am using this:
-(void)detectPhone{

    CGFloat width;
    width= [[UIScreen mainScreen] bounds].size.width;

    if(width==320) {

        CGFloat height;
        height = [[UIScreen mainScreen] bounds].size.height;

        if(height==480) {

            NSLog(@"iPhone 4/4s");
        }

        else {

            NSLog(@"iPhone 5");
        }

    }

    else if (width==375) {

        NSLog(@"iPhone 6");

    }

    else {

        NSLog(@"iPhone 6+");

    }

}

Is there anything wrong with using this method or any situations where it wouldn't work? Ran it through the simulator seems fine. Any pointers would be appreciated. Thanks

A:

Its fine this way, but you are comparing floats, so I would avoid using == for that, instead use >

