nullproduction / SDiPhoneVersion

Objective-C library for detecting the running device's model and screen size.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SDiPhoneVersion

SDiPhoneVersion

![Gitter](https://badges.gitter.im/Join Chat.svg)

Objective-C library for detecting the running device's model and screen size.

With the announcement of the new iPhone models, developers have a little more work to do. This library simplifies their job by allowing them to get information about the running device and easily target the ones they want.

How to use

      //Check for device model
      if ([SDiPhoneVersion deviceVersion] == iPhone6)
           NSLog(@"You got the new iPhone 6. Nice!");
      else if ([SDiPhoneVersion deviceVersion] == iPhone6Plus)
           NSLog(@"You got the iPhone 6 Plus. Bigger is better!");
          
      // Check for device screen size
      if ([SDiPhoneVersion deviceSize] == iPhone4inch)
           NSLog(@"Your screen is 4 inches");
      
      //Get device name
      NSLog(@"%@",[SDiPhoneVersion deviceName]);
      /* e.g: Outputs 'iPhone6,2' */

Add to your project

There are 2 ways you can add SDiPhoneVersion to your project:

Manual installation

Simply import the 'SDiPhoneVersion' into your project then import the following in the class you want to use it:

      #import "SDiPhoneVersion.h"

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like SDiPhoneVersion in your projects. See the "Getting Started" guide for more information.

Podfile

        platform :ios, '5.0'
        pod "SDiPhoneVersion", "~> "1.0"

Available methods

    +(DeviceVersion)deviceVersion;
    +(DeviceSize)deviceSize;
    +(NSString*)deviceName;

Targetable models

iPhone4
iPhone4S
iPhone5
iPhone5C
iPhone5S
iPhone6
iPhone6Plus
Simulator

Targetable screen sizes

iPhone35inch
iPhone4inch
iPhone47inch
iPhone55inch

License

Usage is provided under the MIT License. See LICENSE for the full details.

About

Objective-C library for detecting the running device's model and screen size.

License:MIT License