MvvmCross: MvxImageViewLoader how to set DefaultImagePath property

♀尐吖头ヾ 提交于 2020-01-06 02:38:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!