MvvmCross: MvxImageViewLoader how to set DefaultIm

2019-07-29 13:58发布

How can I set the DefaultImagePath on MvxImageViewLoader?

How can I get the LocalResourcePath for an UImage?

 var imageViewLoader = new MvxImageViewLoader(() => imageView);
 imageViewLoader.DefaultImagePath = UIImage.FromBundle("images/Default.png");
 imageViewLoader.ErrorImagePath = UIImage.FromBundle("images/Error.png");

2条回答
beautiful°
2楼-- · 2019-07-29 14:31

Could not get the above to work, the below though worked right away:

imageViewLoader.DefaultImagePath = NSBundle.MainBundle.PathForResource("Cover", "png");
imageViewLoader.ErrorImagePath = NSBundle.MainBundle.PathForResource("Cover", "png");
查看更多
放我归山
3楼-- · 2019-07-29 14:56

Using resource image paths with is discussed in Using MvxImageViewLoader to load a resource image, is it possible? using the res: prefix

 imageViewLoader.DefaultImagePath = ("res:images/Default.png");

There has also been a recent question saying ErrorImagePath was not working correctly in some http error cases - Adding user agent header to image download request - but no reproduction/issue has been made on this yet.

查看更多
登录 后发表回答