Check iOS version at runtime?

前端 未结 11 1213
-上瘾入骨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:30

    Put this in your Prefix.pch file

    #define IOS_VERSION [[[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."] firstObject] intValue]
    

    And then you can check iOS versions like:

    if(IOS_VERSION == 8)
    {
         // Hello 8!
    }
    else
    {
         // Hello some other version!
    }
    

    Off course if you can use feature detection (and it makes sense for your use case) you should do that.

提交回复
热议问题