开发者

Execute function when iOS version < 4.*

how i can exectute a function if the 开发者_Go百科iOS version is above 4.* in a if statement?

Thanks


Please, take a look at weak linking of classes and methods in Apple's documentation — http://developer.apple.com/library/ios/#DOCUMENTATION/DeveloperTools/Conceptual/cross_development/Using/using.html they provide explicit instructions how to do support of multiple iOS'es in the same build. host answer from this big Apple's documentation:

if ([UIImagePickerController instancesRespondToSelector:
              @selector (availableCaptureModesForCameraDevice:)]) {
    // Method is available for use.
    // Your code can check if video capture is available and,
    // if it is, offer that option.
} else {
    // Method is not available.
    // Alternate code to use only still image capture.
}

Less flexible ways can be done on checking exact match of iOS by use of following code:

NSString *osVersion = [[UIDevice currentDevice] systemVersion];

You can do breakdown of osVersion to components and analyze them separately as numbers.

Cases when you class is not available for some particular iOS type is more complex and it is better to review a link to the document provided above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜