[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: remove -removeSubview:
From: |
Banlu Kemiyatorn |
Subject: |
Re: remove -removeSubview: |
Date: |
Thu, 28 Apr 2011 10:39:30 +0700 |
BTW, I didn't test this but mine is (translated from AP3 lib) like
this, I think it's close to the specs.
- (void) setSubviews: (NSArray *)newSubviews
{
NSEnumerator *en;
NSView* aView;
NSMutableArray *uniqNew = [NSMutableArray array];
en = [newSubviews objectEnumerator];
while ((aView = [en nextObject]))
{
id supersub = [aView superview];
if (supersub != nil && supersub != self)
{
[NSException raise:NSInvalidArgumentException
format:@"Superviews of new subviews must be
either nil or receiver."];
}
if ([uniqNew containsObject:aView])
{
[NSException raise:NSInvalidArgumentException
format:@"Duplicated new subviews."];
}
if (NO == [_subviews containsObject:aView])
{
[self addSubview:aView];
}
[uniqNew addObject:aView];
}
en = [_subviews objectEnumerator];
while ((aView = [en nextObject]))
{
if (NO == [newSubviews containsObject:aView])
{
[aView removeFromSuperview];
}
}
ASSIGN(_subviews, uniqNew); //sorting
}
- Re: remove -removeSubview:, (continued)
- Re: remove -removeSubview:, Wolfgang Lux, 2011/04/27
- Re: remove -removeSubview:, Banlu Kemiyatorn, 2011/04/27
- Re: remove -removeSubview:, Wolfgang Lux, 2011/04/27
- Re: remove -removeSubview:, Banlu Kemiyatorn, 2011/04/27
- Re: remove -removeSubview:, Wolfgang Lux, 2011/04/27
- Re: remove -removeSubview:, Banlu Kemiyatorn, 2011/04/27
- Re: remove -removeSubview:, Quentin Mathé, 2011/04/27
- Re: remove -removeSubview:, Banlu Kemiyatorn, 2011/04/27
- Re: remove -removeSubview:, Quentin Mathé, 2011/04/28
- Re: remove -removeSubview:, Banlu Kemiyatorn, 2011/04/28
- Re: remove -removeSubview:,
Banlu Kemiyatorn <=
- Re: remove -removeSubview:, Banlu Kemiyatorn, 2011/04/28
- Re: remove -removeSubview:, Quentin Mathé, 2011/04/28
- Re: remove -removeSubview:, Banlu Kemiyatorn, 2011/04/28