[NSView removeFromSuperview] not affecting retain count
[NSView removeFromSuperview] not affecting retain count
- Subject: [NSView removeFromSuperview] not affecting retain count
- From: Julian Pellico <email@hidden>
- Date: Sat, 18 Dec 2004 23:29:26 -0800
Hi,
I have a subclass of NSView ( say MyView) and a controller class (say
MyViewController) that manages an instance of this view.
In another controller class (a window controller) I have a method that
does the following:
- (void) removeMyViews
{
for (int i = 0; i < [myViewControllers count]; i++) {
NSLog(@"--- 1 --- retainCount: %u", [[[myViewControllers
objectAtIndex: i] view] retainCount]);
[[[myViewControllers objectAtIndex: i] view] removeFromSuperview];
NSLog(@"--- 2 --- retainCount: %u", [[[myViewControllers
objectAtIndex: i] view] retainCount]);
}
[myViewControllers removeAllObjects];
}
When this method gets run, every time through the loop the retain
count is the same in the 2 log lines.
The "view" method in my controller class is simply
- (NSView*) view
{
return view;
}
Isn't this contrary to the documentation of NSView?
Thanks,
Julian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden