Skip to content

Instantly share code, notes, and snippets.

@binderclip
Created January 29, 2015 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binderclip/17b64a2688b5c676226c to your computer and use it in GitHub Desktop.
Save binderclip/17b64a2688b5c676226c to your computer and use it in GitHub Desktop.
Returns the major version of iOS, from Apple Samplecode: DateCell
/*! Returns the major version of iOS, (i.e. for iOS 6.1.3 it returns 6)
*/
NSUInteger DeviceSystemMajorVersion()
{
static NSUInteger _deviceSystemMajorVersion = -1;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_deviceSystemMajorVersion =
[[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."][0] integerValue];
});
return _deviceSystemMajorVersion;
}
#define EMBEDDED_DATE_PICKER (DeviceSystemMajorVersion() <= 7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment