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

CustomRenderer on iOS - sizing to the bounds of the custom control

$
0
0

I've got a custom ViewRenderer, which I'm using to play a video (so far on iOS). This is working, but the MPMoviePlayerController is being cut off at the bottom of the screen - attached screenshot.

I'm pretty sure it's because I'm using the MainScreen.Bounds in my Renderer:

    protected override void OnElementChanged (ElementChangedEventArgs<VideoPlayer> e)
    {
        base.OnElementChanged (e);

        _player = new UIVideoPlayer (e.NewElement.FileSource, (RectangleF)UIScreen.MainScreen.Bounds);

        base.SetNativeControl (_player);
    }

However, if I try to use this.Bounds or e.NewElement.Bounds the player is hidden - because these Bounds objects are empty at the time that OnElementChanged is called.

Where/when can I obtain the proper Bounds of the Element so I can fit the Player in it?


Viewing all articles
Browse latest Browse all 77050

Trending Articles