问题
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");
回答1:
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.
回答2:
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");
来源:https://stackoverflow.com/questions/18498656/mvvmcross-mvximageviewloader-how-to-set-defaultimagepath-property