Hello,
After testing, setting the BackgroundColor
in both parts of the following code works as expected.
public class AppDelegate : UIApplicationDelegate
{
public override UIWindow? Window
{
get;
set;
}
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// create a new window instance based on the screen size
Window = new UIWindow(UIScreen.MainScreen.Bounds);
var rootView = new MainViewController();
// Part 1
rootView.View.BackgroundColor = UIColor.SystemMint;
Window.RootViewController = rootView;
Window.MakeKeyAndVisible();
return true;
}
}
public class MainViewController : UIViewController
{
public override void ViewDidLoad()
{
View = new UIView
{
};
//Or Part 2
View.BackgroundColor = UIColor.SystemMint;
base.ViewDidLoad();
// Perform any additional setup after loading the view
}
}
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.