• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[NSView removeFromSuperview] not affecting retain count
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[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

  • Follow-Ups:
    • Re: [NSView removeFromSuperview] not affecting retain count
      • From: "John C. Randolph" <email@hidden>
    • Re: [NSView removeFromSuperview] not affecting retain count
      • From: j o a r <email@hidden>
  • Prev by Date: Re: How to capture a full screen image
  • Next by Date: Re: NSAlert strategy advice
  • Previous by thread: Re: Using bindings across frameworks
  • Next by thread: Re: [NSView removeFromSuperview] not affecting retain count
  • Index(es):
    • Date
    • Thread