* Fix for Bug #934 (IconTintColorEffect does not work when the image is in Shared project as EmbeddeResource) * Revised Fix for #934 * Update src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/IconTintColor/IconTintColorEffectRouter.ios.cs Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> * Update src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/IconTintColor/IconTintColorEffectRouter.ios.cs Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> * Revised Fix #2 for Bug #934 * updated the sample * improved variable name * changed the null check object * Update IconTintColorEffectRouter.ios.cs To Fix ClearTintColor Crash I have added a null check on button.ImageView in ClearTintColor to prevent a crash when OnDetach is called. This NullReferenceException occured when changing Application.MainPage. * Update IconTintColorEffectRouter.ios.cs To Fix ClearTintColor Crash Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
This commit is contained in:
Родитель
5859251e81
Коммит
57744235cc
|
@ -23,8 +23,8 @@ namespace Xamarin.CommunityToolkit.iOS.Effects
|
|||
base.OnElementPropertyChanged(args);
|
||||
|
||||
if (!args.PropertyName.Equals(IconTintColorEffect.TintColorProperty.PropertyName) &&
|
||||
!args.PropertyName.Equals(Image.SourceProperty.PropertyName) &&
|
||||
!args.PropertyName.Equals(ImageButton.SourceProperty.PropertyName))
|
||||
!args.PropertyName.Equals(Image.SourceProperty.PropertyName) &&
|
||||
!args.PropertyName.Equals(ImageButton.SourceProperty.PropertyName))
|
||||
return;
|
||||
|
||||
ApplyTintColor();
|
||||
|
@ -53,17 +53,17 @@ namespace Xamarin.CommunityToolkit.iOS.Effects
|
|||
switch (Control)
|
||||
{
|
||||
case UIImageView imageView:
|
||||
Element.PropertyChanged -= ImageViewTintColorPropertyChanged;
|
||||
if (imageView.Image != null)
|
||||
{
|
||||
Element.PropertyChanged -= ImageViewTintColorPropertyChanged;
|
||||
imageView.Image = imageView.Image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
|
||||
}
|
||||
|
||||
break;
|
||||
case UIButton button:
|
||||
if (button.ImageView.Image != null)
|
||||
Element.PropertyChanged -= ButtonTintColorPropertyChanged;
|
||||
if (button.ImageView?.Image != null)
|
||||
{
|
||||
Element.PropertyChanged -= ButtonTintColorPropertyChanged;
|
||||
var originalImage = button.CurrentImage.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
|
||||
button.SetImage(originalImage, UIControlState.Normal);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче