Try this:
Update:
NSArray *vComp = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
if ([[vComp objectAtIndex:0] intValue] >= 7) {
// iOS-7 code[current] or greater
} else if ([[vComp objectAtIndex:0] intValue] == 6) {
// iOS-6 code
} else if ([[vComp objectAtIndex:0] intValue] > 2) {
// iOS-3,4,5 code
} else {
// iOS-1,2... code: incompatibility warnings, legacy-handlers, etc..
}
Previous code:
NSArray *vComp = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
if ([[vComp objectAtIndex:0] intValue] == 6) {
// iOS-6 code
} else {
// iOS-5, iOS-4... code
}
To specifically check for a subversion of IOS use
float sysVer = [[[UIDevice currentDevice] systemVersion] floatValue];
if (sysVer > 6.01) {
// iOS-6.01+ code
} else {
// prior iOS versions
}