本文整理自网络,侵删。
获取正在运行的设备是iPhone还是iPad在FMX.Helpers.iOS单元中使用IsPhone函数和IsPad。
uses FMX.Helpers.iOS;
procedure TForm1.Button1Click(Sender: TObject);begin if IsPhone then ShowMessage('iPhone'); if IsPad then ShowMessage('iPad');end;
获取模型(模型名称),名称和版本您可以使用TUIDevice获取设备信息。
uses iOSapi.UIKit;
procedure TForm1.Button1Click(Sender: TObject);var Model, Name, LocalizedModel, SystemName, SystemVersion: string;begin //设备模型 Model := UTF8ToString(TUIDevice.Wrap(TUIDevice.OCClass.currentDevice).model.UTF8String); Memo1.Lines.Add('Model=' + Model);
// 设备名称 Name := UTF8ToString(TUIDevice.Wrap(TUIDevice.OCClass.currentDevice).name.UTF8String); Memo1.Lines.Add('Name=' + Name);
// 设备的本地版本 LocalizedModel := UTF8ToString(TUIDevice.Wrap(TUIDevice.OCClass.currentDevice).localizedModel.UTF8String); Memo1.Lines.Add('LocalizedModel=' + LocalizedModel);
// OS名 SystemName := UTF8ToString(TUIDevice.Wrap(TUIDevice.OCClass.currentDevice).systemName.UTF8String); Memo1.Lines.Add('SystemName=' + SystemName);
// OS名 SystemVersion := UTF8ToString(TUIDevice.Wrap(TUIDevice.OCClass.currentDevice).systemVersion.UTF8String); Memo1.Lines.Add('SystemVersion=' + SystemVersion);end;可以获取的模型如下。
iPhone手机iPod触控的iPadiPhone模拟器
相关阅读 >>
Delphi异常处理try except语句和try finally语句用法以及区别
Delphi tnotification android通知
Delphi 10.3 调试程序时出错:unable to create process:请求的操作需要提升
更多相关阅读请进入《Delphi》频道 >>