Smartmobili.Cocoa.NSView.SetSubviews C# (CSharp) Метод

SetSubviews() публичный Метод

public SetSubviews ( NSArray newSubviews ) : void
newSubviews NSArray
Результат void
        public virtual void SetSubviews(NSArray newSubviews)
        {
            NSEnumerator en;
            NSView aView;
            NSMutableArray uniqNew = NSMutableArray.Array();

            if (null == newSubviews)
            {
                NSException.Raise(@"NSInvalidArgumentException" ,@"Setting nil as new subviews.");
            }

            // Use a copy as we remove from the subviews array
            en = NSArray.ArrayWithArray(_sub_views).ObjectEnumerator();
            while ((aView = (NSView)en.NextObject()) != null)
            {
                if (false == newSubviews.ContainsObject(aView))
                {
                    aView.RemoveFromSuperview();
                }
            }

            en = newSubviews.ObjectEnumerator();
            while ((aView = (NSView)en.NextObject()) != null)
            {
                id supersub = aView.Superview;

                if (supersub != null && supersub != this)
                {
                    NSException.Raise(@"NSInvalidArgumentException" ,@"Superviews of new subviews must be either nil or receiver.");
                }

                if (uniqNew.ContainsObject(aView))
                {
                    NSException.Raise(@"NSInvalidArgumentException" ,@"Duplicated new subviews.");
                }

                if (false == _sub_views.ContainsObject(aView))
                {
                    this.AddSubview(aView);
                }

                uniqNew.AddObject(aView);
            }

            _sub_views = uniqNew;

            // The order of the subviews may have changed
            this.SetNeedsDisplay(true);
        }
NSView