Xamarin.Plugins
Xamarin.Plugins copied to clipboard
IconToolbarItem/FreshMVVM Dilema
I've been attempting to get IconToolbarItem to play nicely with FreshMVVM.. When run on iOS (Xamarin Forms), I am getting the following exception
Could not initialize an instance of the type 'UIKit.UIImage': the native 'initWithContentsOfFile:' method returned nil.
It appears the instance of IconToolbarItem is interpreting the Icon property ("fa-refresh" in this case) as a file name. I'm fairly certain that this issue is caused by the fact that FreshMVVM is internally creating and utilizing NavagationPage pages instead of IconNavigationPage. All of the other Iconize views are working normally, so it is not a configuration issue.
While this is not strictly an issue with IconToolbarItem, it is a nasty roadblock preventing one from using these two superb libraries together. I'm hoping the contributors here, have a suggestion for how I might best proceed with getting this to work.
I'm having the same problem. My work around on android was to create:
public class MyNavigationContainer : IconNavigationPage, IFreshNavigationService { // copy everything from FreshNavigationContainer }
But this still gives the same error on IOS as you're getting.
I believe the problem is the fact that the Icon property is used for holding the name of the character to render, this is not a valid resource image name so Mono is throwing an exception.
I have confirmed that the Icon property on IconToolbarItem should not be used as the holder for the Icon, if you set the Icon to say fa-barcode and then create images fa-barcode.png the fa-barcode.png is rendered as the IconToolbarItem icon, not the fa-barcode character from fontawesome.
I thought maybe I could work around the problem by putting in stub images, hoping that the Icon would switch on load, but no, it always displays the stub image.
I have same problem and noticed that the IsVisibleProperty binding not work too.
I'm with this problem too, there any news?
I found ~~the solution~~ workaround