[MonoTouch] Background image not filling screen
Chris House
chrishouse at proag.com
Thu Mar 22 13:22:15 UTC 2012
René - thank you! Moving the code to ViewWillAppear() did the trick.
From: René Ruppert [mailto:rene.ruppert at googlemail.com]
Sent: Thursday, March 22, 2012 2:54 AM
To: Chris House; monotouch at lists.ximian.com
Subject: AW: [MonoTouch] Background image not filling screen
I think ViewDidLoad() is too early. Try putting the code in ViewWillAppear(). That's when the view's coordinates are final.
René
Von: monotouch-bounces at lists.ximian.com [mailto:monotouch-bounces at lists.ximian.com] Im Auftrag von Chris House
Gesendet: Mittwoch, 21. März 2012 22:22
An: monotouch at lists.ximian.com
Betreff: [MonoTouch] Background image not filling screen
A screenshot demonstrating my problem can be seen here:
http://i44.tinypic.com/288pmo8.png
I have an iPad app with a UIToolbar at the top of the screen and a UITabBarController at the bottom of the screen. I want to fill the space between the two with an image. I've used the following code to do so:
public override void ViewDidLoad()
{
base.ViewDidLoad();
UIImageView backgroundImageView = new UIImageView(this.View.Bounds);
backgroundImageView.Image = UIImage.FromBundle("Images/background_image.png");
backgroundImageView.ContentMode = UIViewContentMode.ScaleAspectFill;
this.View.AddSubview(backgroundImageView);
}
I've used this same code in other apps without the toolbar/tab bar controller and it filled the entire screen. As you can see from my screenshot, in this app I am ending up with a gap at the bottom between the image and the tab bar. I'm probably missing something obvious. Any pointers in the right direction would be much appreciated.
Thanks!
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monotouch/attachments/20120322/f4bd5fdf/attachment-0001.html>
More information about the MonoTouch
mailing list