0

我正在使用 ELCImagepicker.dll 创建具有多图像选择的画廊。一切正常。

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

这是媒体服务文件。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);
            }
        }
    }
}

请指导 在此处输入图像描述

4

1 回答 1

0

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

提示文字:<a href="https://github.com/B-Sides/ELCImagePickerController/blob/a96964e7ab9d2bfc3cefe48038985ba4db8adf47/Classes/ELCImagePicker/ELCImagePickerController.m#L75" rel="nofollow noreferrer">这里

图标:这里

于 2018-04-13T08:14:26.283 回答