虽然,您的问题不是完全描述性的,并且不确定您想要通过从给定链接说“不工作”来实现什么。
将以下代码写入ViewController您希望仅NavigationBar针对该特定实现 Transperent 的各个覆盖方法ViewController。
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
if (NavigationController != null)
{
NavigationController.NavigationBar.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
NavigationController.NavigationBar.ShadowImage = new UIImage();
NavigationController.NavigationBar.Translucent = true;
NavigationController.View.BackgroundColor = UIColor.Clear;
NavigationController.NavigationBar.BackgroundColor = UIColor.Clear;
}
}
public override void ViewWillDisappear(bool animated)
{
base.ViewWillDisappear(animated);
if (NavigationController != null)
{
NavigationController.NavigationBar.SetBackgroundImage(null, UIBarMetrics.Default);
NavigationController.NavigationBar.ShadowImage = null;
NavigationController.NavigationBar.BarTintColor = UIColor.Red; //Provide your specific color here
}
}
Run Code Online (Sandbox Code Playgroud)
如果要全局设置,请在AppDelegate的FinishedLaunching方法中尝试:
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
UINavigationBar.Appearance.ShadowImage = new UIImage();
UINavigationBar.Appearance.BackgroundColor = UIColor.Clear;
UINavigationBar.Appearance.Translucent = true;
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助!。
| 归档时间: |
|
| 查看次数: |
1715 次 |
| 最近记录: |