2016-05-02 17 views
0

私はXamarin.Formsを使用しています.iOSでは、トップアクションバーをカスタマイズする必要があります。 この場合、上部のアクションバーと下のコンテンツビューの間の暗い線を削除する必要があります(スクリーンショット参照)。 どうすればいいですか?iamのXamarin.Formsカスタマイズアクションバー

ありがとうございます!

enter image description here

私はここでそれをやったし、それが働い:

public override bool FinishedLaunching(UIApplication app, NSDictionary options) 
     { 
      //Tab bar 
      UITabBar.Appearance.SelectedImageTintColor = UIColor.FromRGB(247, 139, 43); 
      //Switch 
      UISwitch.Appearance.OnTintColor = UIColor.FromRGB(247, 139, 43); 
      //---------------------------------------------------------------------------- 
      UINavigationBar.Appearance.BarTintColor = UIColor.Clear; 
      UINavigationBar.Appearance.ShadowImage = new UIImage(); 
      UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); 
      //----------------------------------------------------------------------------      
      global::Xamarin.Forms.Forms.Init();    
      ImageCircleRenderer.Init();     
      LoadApplication(new App()); 

      return base.FinishedLaunching(app, options); 
     } 
+0

ちょうどそれ、多くのありがとう! – Stefano

答えて

0

カスタムレンダラ作成することによって、これを達成することができます:AppDelegateで、

[assembly: ExportRenderer(typeof(CustomNavigationPage), typeof(CustomNavigationRenderer))] 
    namespaceiOS.Renderers 
    { 
     public class CustomNavigationRenderer : NavigationRenderer 
     { 

      public override void ViewDidLoad() 
      { 
       base.ViewDidLoad(); 

       this.NavigationBar.ShadowImage = new UIImage(); 
       this.NavigationBar.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); 
      } 
      } 
    } 

またはあなたのiOSプロジェクトでのメソッド "FinishedLaunching"を使用すると、UIAppearance APIを使用して、アプリケーション全体のスタイルを設定できます。

UINavigationBar.Appearance.ShadowImage = new UIImage(); 
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); 
+0

これは唯一の方法ですか? AndroidプロジェクトのようにXamarin.iOSプロジェクトで設定できる設定やスタイルはありませんか? – Stefano

+0

ちょっと編集しました。お役に立てれば。 – wishmaster

+0

はい、それは助けます!私はAppDelegate.csでこれをFinishedLaunchingの中で行いました。上記のコメントに載っていて、うまくいきました。それは大丈夫ですか、私は "DidFinishLaunching"の中でそれをしなければなりません。この場合、「DidFinishLaunching」の内部をどのように配置するのか知っていますか?ありがとう!!! – Stefano

関連する問題