gpt4 book ai didi

ios - 查找存储启动图像的位置

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:03:29 24 4
gpt4 key购买 nike

部署页面状态启动图像存储在根目录中。

但是,当使用 FileExists 时,以下所有路径都返回 false,所以...

FileExists(TPath.GetHomePath + PathDelim + 'LaunchImage_320x480.png');
FileExists(TPath.GetHomePath + PathDelim + Application.Title + '.app' + PathDelim + 'LaunchImage_320x480.png');
FileExists(TPath.GetDocumentsPath + PathDelim + 'LaunchImage_320x480.png');
FileExists('' + 'LaunchImage_320x480.png');
FileExists('.\' + 'LaunchImage_320x480.png');

最佳答案

如文档所述,启动图像应存储在与应用程序相同的文件夹中。您应该能够使用 NSBundle.pathForResource 获取文件名。

uses
iOSapi.Foundation, Macapi.Helpers;

procedure TForm1.FormCreate(Sender: TObject);
var
FileName: string;
begin
FileName := NSStrToStr(TNSBundle.Wrap(TNSBundle.OCClass.mainBundle).pathForResource(NSSTR('Default'), NSStr('png')));
//....
end;

诀窍可能是启动图像的文件名不一定与 IDE 中的文件名相同。您可以像这样列出应用程序中的所有文件:

uses
iOSapi.Foundation, Macapi.Helpers, System.IOUtils;

procedure TForm1.Button1Click(Sender: TObject);
var
FileName: string;
files: TStringDynArray;
AppFolder: string;
I: Integer;
begin
AppFolder := NSStrToStr((TNSBundle.Wrap(TNSBundle.OCClass.mainBundle).bundlePath));
Files := TDirectory.GetFiles(AppFolder);
for I := 0 to Length(Files) - 1 do
Memo1.Lines.Add(ExtractFileName(Files[I]));
end;

您也可以使用像 DiskAid 这样的工具来查看 Windows 上的 iOS 应用程序文件夹。

关于ios - 查找存储启动图像的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18090604/

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