如何在Xamarin.forms中更改ELCImagepicker的Tick图标?

时间:2018-04-12 08:54:44

标签: c# xamarin.forms xamarin.ios elcimagepickercontroller

我正在使用ELCImagepicker.dll创建具有多个图像选择的图库。一切都很好。

1-我想在用户选择时更改Tick的图标。这是一种非常古老的风格 2-更改最大选择的验证消息。我想使用"选择"而不是"发送"。

这是MediaService文件。 maxImage设置最大图片验证

public class MediaService : IMediaService
{
    public async Task OpenGallery(int maxImage)
    {
        var picker = ELCImagePickerViewController.Create(maxImage);
        picker.MaximumImagesCount = maxImage;

        var topController = UIApplication.SharedApplication.KeyWindow.RootViewController;
        while (topController.PresentedViewController != null)
        {

            topController = topController.PresentedViewController;
        }
        topController.PresentViewController(picker, true, null);
        List<string> images = new List<string>();
        await picker.Completion.ContinueWith(t =>
        {
            picker.BeginInvokeOnMainThread(() =>
            {
                //dismiss the picker
                picker.DismissViewController(true, null);

                if (t.IsCanceled || t.Exception != null)
                {
                }
                else
                {
                    //List<string> images = new List<string>();

                    var items = t.Result as List<AssetResult>;
                    foreach (var item in items)
                    {
                        var path = Save(item.Image, item.Name);
                        images.Add(path);
                        //CleanPath(path);
                    }


                }
            });
        });
        MessagingCenter.Send<App, List<string>>((App)Xamarin.Forms.Application.Current, "ImagesSelected", images);
    }

    string Save(UIImage image, string name)
    {
        var documentsDirectory = Environment.GetFolderPath
                              (Environment.SpecialFolder.Personal);
        string jpgFilename = System.IO.Path.Combine(documentsDirectory, name); // hardcoded filename, overwritten each time
        NSData imgData = image.AsJPEG();
        NSError err = null;
        if (imgData.Save(jpgFilename, false, out err))
        {
            return jpgFilename;
        }
        else
        {
            Console.WriteLine("NOT saved as " + jpgFilename + " because" + err.LocalizedDescription);
            return null;
        }
    }

    void IMediaService.ClearFiles(List<string> filePaths)
    {
        var documentsDirectory = Environment.GetFolderPath
                          (Environment.SpecialFolder.Personal);

        if (Directory.Exists(documentsDirectory))
        {
            foreach (var p in filePaths)
            {
                File.Delete(p);
            }
        }
    }
}

请指导 enter image description here

1 个答案:

答案 0 :(得分:0)

由于作者没有公开可以更改图标或文本的api,因此您必须在源代码中更改它们,然后创建dll以供使用。

提醒文字:here

图标:here