AwakeFromNib not being called on OnElementChanged

parzivalmxparzivalmx Member ✭✭

I migrated my project to .Net Standard but I'm having an issues with an iOS rendered. The code base is the same but it fails on the .Net Standard 2.0 with the newest xamarin.forms

I have this Rendered

public partial class ImagesView : PageRenderer {
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);
            ((ImageGalleryPage)Element).CallToNativeMethod += (sender, i) =>
            {
                //code here
            };
        }
 public override void ViewDidLoad()
        {
        //code here
    }
}

And I have a UIColletionView with an awake from nib that should be fired up when calling the OnElementChanged on the ImagesView. This works on my old project but not on the updated one.

public partial class ImageCollectionView : UICollectionView
    {
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();
            // Initialize
        }
    }

any idea why it would not fire up?

Posts

  • parzivalmxparzivalmx Member ✭✭

    So adding more breakpoints to the code I realize, this part is not being entered, inside the OnElementChanged

    ((ImageGalleryPage)Element).CallToNativeMethod += (sender, i) =>
                {
                    CleanGalleryImages();
                    alreadyLoadedImg = false;
                };
    
  • parzivalmxparzivalmx Member ✭✭

    So i downgraded my Xamarin.Forms and its working. Why this will happen?

Sign In or Register to comment.