public void Update(int index, IView child) { _ = NativeView ?? throw new InvalidOperationException($"{nameof(NativeView)} should have been set by base class."); _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); _ = MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); var existing = NativeView.Subviews[index]; existing.RemoveFromSuperview(); NativeView.InsertSubview(child.ToNative(MauiContext), index); NativeView.SetNeedsLayout(); }
public void Update(int index, IView child) { _ = PlatformView ?? throw new InvalidOperationException($"{nameof(PlatformView)} should have been set by base class."); _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); _ = MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); var existing = PlatformView.Subviews[index]; existing.RemoveFromSuperview(); var targetIndex = VirtualView.GetLayoutHandlerIndex(child); PlatformView.InsertSubview(child.ToPlatform(MauiContext), targetIndex); PlatformView.SetNeedsLayout(); }
/// <summary> /// Invalidates the layout of the selected view. For iOS, calls the SetNeedsLayout method. /// </summary> /// <param name="view">The view to invalidate.</param> public static void InvalidateMeasure(this _View view) { view.SetNeedsLayout(); }