[英]Xamarin.iOS how do I change the status status bar color when there is no Navigation bar
[英]How to change status bar icons color in IOS version under 13 - Xamarin Forms?
我只是無法在我的 Xamarin Forms App 的 13 歲以下的 IOS 版本中更改狀態欄圖標顏色。 我已經這樣做了,並且在 13 以上的 IOS 版本上效果很好。我可以更改背景顏色,但我不需要它,我需要圖標本身。
看示例:此代碼僅用於更改狀態欄 BackgroundColor,我設置了 status.TintColor 但它不會更改...
private void ChangeStatusBar()
{
UIView statusBar = UIApplication.SharedApplication.ValueForKey(new NSString("statusBar")) as UIView;
if (statusBar.RespondsToSelector(new ObjCRuntime.Selector("setBackgroundColor:")))
{
statusBar.BackgroundColor = UIColor.White;
statusBar.TintColor = UIColor.White;
UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
}
}
我使用它來更改 13 以上 IOS 版本中的狀態欄圖標顏色並且工作正常:
UIApplication.SharedApplication.SetStatusBarStyle(isLightTheme ? UIStatusBarStyle.LightContent : UIStatusBarStyle.DarkContent, false);
GetCurrentViewController().SetNeedsStatusBarAppearanceUpdate();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.