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

Photo Overlay for iOS using the Media Plugin

$
0
0

I am having difficulty implementing the Photo Overlay for iOS using the Media Plugin. I am trying to use Dependency Services to pass the function to the shared code, but have not succeeded. I am really stuck on how to implement the Dependency Service correctly.

My interface:
namespace TruFit
`{
public interface IPhotoOverlay
{
//Func Overlay = CreateOverlay;
object GetImageOverlayAsync();
//Func GetImageOverlayAsync();

    //Task<Stream> GetImageOverlayAsync();
}

}`

iOS code:
` public object GetImageOverlayAsync()
{
Func func = CreateOverlay;

        return func;
    }

    public object CreateOverlay()
    {
        var imageView = new UIImageView(UIImage.FromBundle("face-template.png"));
        imageView.ContentMode = UIViewContentMode.ScaleAspectFit;

        var screen = UIScreen.MainScreen.Bounds;
        imageView.Frame = screen;

        return imageView;
    }`

My shared code:
var photo = await Plugin.Media.CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions() { //OverlayViewProvider = DependencyService.Get<IPhotoOverlay>().GetImageOverlayAsync, DefaultCamera = Plugin.Media.Abstractions.CameraDevice.Front});


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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