Reputation: 898
How can I change the global tint color of my iOS app in a Xamarin forms project (C#)?
Upvotes: 5
Views: 2531
Reputation: 1625
Add following code in your applications finished launching method in Xamarin.iOS Project.
Boolean result = base.FinishedLaunching(app, options);
UIApplication.SharedApplication.KeyWindow.TintColor = UIColor.Green;
return result;
Upvotes: -1
Reputation: 14126
The global iOS tint color can be set via UIApplication.KeyWindow
when it becomes available, the earliest after the application finished launching:
using Foundation;
using UIKit;
namespace MyApp.iOS
{
[Register("AppDelegate")]
public class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
var result = base.FinishedLaunching(uiApplication, launchOptions);
uiApplication.KeyWindow.TintColor = UIColor.Blue;
return result;
}
}
}
Upvotes: 4