/// <summary>
        /// Removes the provided child from this view.
        /// </summary>
        /// <param name="child">The child to remove</param>
        public static void RemoveChild(this _View view, _View child)
        {
            if (child.Superview != view)
            {
                throw new Exception("This child not part of this view");
            }

            child.RemoveFromSuperview();
        }
Example #2
0
        public void TestThatANonLeafNodeCanBecomeALeafNode()
        {
            var containerSize = new SizeF(300, 50);

            var container = new NativeView(new CGRect(0, 0, containerSize.Width, containerSize.Height));

            container.Yoga().IsEnabled = true;

            var subview1 = new NativeView();

            subview1.Yoga().IsEnabled = true;
            container.AddSubview(subview1);

            var subview2 = new NativeView();

            subview2.Yoga().IsEnabled = true;
            container.AddSubview(subview2);
            container.Yoga().ApplyLayout();
            subview2.RemoveFromSuperview();
            container.Yoga().ApplyLayout();
        }