Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

iOS Background image scale

$
0
0

Hi,

I noticed many people have the problem of the background image of a forms page not scaling in iOS. I solved it with this code:

[assembly: ExportRenderer(typeof(InfoPage), typeof(InfoPage_iOS))]

namespace Oxaco_BBC.iOS
{
    public class InfoPage_iOS : PageRenderer
    {
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(false);

            UIGraphics.BeginImageContext(this.View.Frame.Size);
            UIImage i = UIImage.FromFile("Background.png");
            i = i.Scale(this.View.Frame.Size);

            this.View.BackgroundColor = UIColor.FromPatternImage(i);

        }
    }
}

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>