XE8 设置 IOS app statusbar 背景色

Setting the background color of statusbar in IOS app in XE8

我想在我新创建的 Delphi XE8 Firemonkey 应用程序中设置状态栏的背景颜色(和前景颜色)。对于状态栏,我指的是带有时间和 wifi 小部件的顶部栏。

我就是找不到。我需要一些帮助:-)

谢谢, 爱德华

来自 Harry Stahl 的书“使用 Delphi XE7 和 FireMonkey 进行 Windows & MAC OS X 的跨平台开发”一书的推荐

TStatusbar (a way to compensate the missing “Panels”)

In the VCL status bar you can display a text either on the property “Panels” or via the “SimpleText” property. In the FireMonkey status bar there is nothing of the sort, no text property. So you could use the status bar as container and there, for example, insert Labels .

Better solution: Just take a TGrid! As you can see in the screenshot shown below, I have included in the StatusBar a TGrid. In the TGrid I have 2 TStringColumns, a TImageColumn, again a TStringColumn and a TProgressColumn added. In the Objectinspector, I have set for the TGrid:

窗体的Fill.Color控制工具栏的颜色,该颜色的平均亮度控制文本是白色还是黑色

边框样式必须 <> None,否则工具栏将被隐藏。

如果您有多个表单,不太清楚使用的是哪个表单,但它似乎是您的项目文件中自动创建的最后一个表单。

这是来自 FMX.Platform.iOS.pas 的一些相关源代码,记录了文本的颜色:

procedure TPlatformCocoaTouch.UpdateStatusBarColor(const AForm: TCommonCustomForm);
  ...
  AppDelegate.MainWindow.RootViewController.SetStatusBarBackgroundColor((AForm as TCustomForm).Fill.Color);
  ...

procedure TFMXViewController.SetStatusBarBackgroundColor(const ABackgroundColor: TAlphaColor);
  ...
  FStatusBarLuminance := Luminance(ABackgroundColor);
  ...

function TFMXViewController.preferredStatusBarStyle: UIStatusBarStyle;
begin
  if FStatusBarLuminance < 0.5 then
    Result := UIStatusBarStyleLightContent
  else
    Result := UIStatusBarStyleDefault;
end;

PS。我还有另一个未解决的问题,关于如何 make the statusbar transparent,这是原生 iOS 7+ 行为。