检测IOS的版本信息

up vote 4 down vote accepted

You can use TOSVersion record in System.SysUtils.

if TOSVersion.Check(7, 0) then //Os is iOS 7

TOSVersion = record
  public type
    TArchitecture = (arIntelX86, arIntelX64, arARM32);
    TPlatform = (pfWindows, pfMacOS, pfiOS, pfAndroid, pfWinRT, pfLinux);
  public const
    AllArchitectures = [arIntelX86, arIntelX64, arARM32];
    AllPlatforms = [pfWindows, pfMacOS, pfiOS, pfAndroid, pfWinRT, pfLinux];
  private
    class var FArchitecture: TArchitecture;
    class var FBuild: Integer;
    class var FMajor: Integer;
    class var FMinor: Integer;
    class var FName: string;
    class var FPlatform: TPlatform;
    class var FServicePackMajor: Integer;
    class var FServicePackMinor: Integer;
    class constructor Create;
  public
    class function Check(AMajor: Integer): Boolean; overload; static; inline;
    class function Check(AMajor, AMinor: Integer): Boolean; overload; static; inline;
    class function Check(AMajor, AMinor, AServicePackMajor: Integer): Boolean; overload; static; inline;
    class function ToString: string; static;
    class property Architecture: TArchitecture read FArchitecture;
    class property Build: Integer read FBuild;
    class property Major: Integer read FMajor;
    class property Minor: Integer read FMinor;
    class property Name: string read FName;
    class property Platform: TPlatform read FPlatform;
    class property ServicePackMajor: Integer read FServicePackMajor;
    class property ServicePackMinor: Integer read FServicePackMinor;
  end;

Detecting iOS 6 and iOS 7

To detect the iOS version being used on the target iOS device (and to assign an appropriate available style at run time), use the TOSVersion.Check method as follows.

Example:

Delphi:

{$IFDEF IOS}
    if TOSVersion.Check(7, 0) then
        Style := TStyleManager.LoadFromResource(HInstance, 'iOS7Jet', RT_RCDATA)
    else
        Style := TStyleManager.LoadFromResource(HInstance, 'iOSJet', RT_RCDATA);
{$ENDIF}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值