gpt4 book ai didi

ios - 在 Delphi 中检测 iPad 方向

转载 作者:行者123 更新时间:2023-12-02 23:20:35 25 4
gpt4 key购买 nike

我本以为 XE4 中会有一个 OnRotate 事件,但似乎使用了 OnResize 。明白了。

但是,我需要确定设备的方向。我确信这很简单,但 Google 帮不上忙!

最佳答案

要检测设备的当前方向,您可以使用 statusBarOrientation 方法,该方法是UIApplication 的一部分。类。

尝试这个示例

uses
iOSapi.UIKit;

function SharedApplication:UIApplication;
begin
Result:=TUIApplication.Wrap(TUIApplication.OCClass.sharedApplication);
end;

procedure TForm23.Button1Click(Sender: TObject);
var
LOrientation: Cardinal;
begin
LOrientation := SharedApplication.statusBarOrientation;
if (LOrientation = UIDeviceOrientationLandscapeLeft) or (LOrientation = UIDeviceOrientationLandscapeRight) then
ShowMessage('Landscape')
else
if (LOrientation = UIInterfaceOrientationPortrait) then
ShowMessage('Portrait');
end;

关于ios - 在 Delphi 中检测 iPad 方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17592637/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com