Set background image to UIViewController (MonoTouch)

I have a screen called HomeScreen that implements a UIViewController. I want to use a background image for this screen. Is there an event that I can override to set this background image in the HomeScreen.cs file?

+7
source share
3 answers

try setting the backgroundcolor of your view

myview.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("myimage.png")); 
+13
source

Try adding the following to your MyViewNameViewController.cs file:

 public override void ViewDidLoad() { base.ViewDidLoad(); this.View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("splash.png")); } 
+1
source

I voted for other answers, however today the iPhone has different sizes, and the correct way to download the image is to use the UIImage.FromBundle method:

Here is the catalog of claims in the project:

enter image description here

Image Management:

enter image description here

 public override void ViewDidLoad() { base.ViewDidLoad(); // replace "name" with the desired name in the asset catalog this.View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle("name")); } 
0
source

All Articles