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

标签 ios delphi delphi-xe5 delphi-xe4 delphi-xe6

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

但是,当使用 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/

相关文章:

ios - 如何更改 statusBarFrame 颜色以与 Swift iOS 13 中的 NavigationController 保持相同

ios - 在标签中滑动文本

delphi - "Reference to"在 Delphi 中究竟做了什么?

xml - 如何将节点的内部文本和XML提取为字符串?

delphi - 从 Delphi 中的 Windows Message 获取串行端口的友好名称

android - 确定定位服务是否开启

ios - 我的 friend 可以在不越狱的情况下运行我的 iPhone 应用程序吗?

ios - 将 GMS 标记分配给 NSMutableArray Objective-C

delphi - 将当前Windows主题保存到vsf文件

delphi - 为什么两个看似相同的动态数组类型被视为赋值不兼容?