Check iOS version at runtime?

前端 未结 11 1227
-上瘾入骨i
-上瘾入骨i 2020-12-01 03:03

This is sort of a follow on from my last question. I am using beginAnimations:context: to setup an animation block to animate some UITextLabels. However I notic

11条回答
  •  难免孤独
    2020-12-01 03:14

    For my purposes I've written a tiny library that abstracts away the underlying C calls and presents an Objective-C interface.

    GBDeviceDetails deviceDetails = [GBDeviceInfo deviceDetails];
    if (deviceDetails.iOSVersion >= 6) {
        NSLog(@"It's running at least iOS 6");      //It's running at least iOS 6
    }
    

    Apart from getting the current iOS version, it also detects the hardware of the underlying device, and gets info about the screen size; all at runtime.

    It's on github: GBDeviceInfo. Licensed under Apache 2.

提交回复
热议问题