• 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
Re: shared instance and nstableview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shared instance and nstableview


  • Subject: Re: shared instance and nstableview
  • From: Yorh <email@hidden>
  • Date: Wed, 10 May 2006 01:10:13 +0200

Hi Lawarence and thank you,

Yes is true, but this is not the problem, my nstableview continue to not refresh...
I cannot understand why, because all data are inside my shared instance and I can access all the data calling the accessor methods like [[GAChannelList sharedList]allData]; .


I cannot see the end of the tunnel, because it seems that is the delegate class (the datasource) that has some problem.
Maybe you have some example about it?


Thank you for your kind support
Yorh

On May 10, 2006, at 1:02 AM, Lawrence Sanbourne wrote:

On 5/9/06, Yorh <email@hidden> wrote:
Hi to all,

I have a strange problem with a nstableview and a data model.
I have a datasource with all the standard delegate methods of the
nstableview and a data model that is shared.
The data source is instatiate by IB , and the data model directly by
the init method:

+(GAChannelList*)sharedInstance{
        static GAChannelList * sharedList = nil;
        if (sharedList == nil) {
        sharedList = [[GAChannelList alloc] init];
        }
        return sharedList;
}


Hi Yorh,

The problem is that you're setting sharedList to nil every time
+sharedInstance is called. Try this instead:

static GAChannelList * sharedList;

Objects in Objective-C are automatically initialized to nil, so this
should have the intended behavior.

For a "stronger" singleton implementation, you may wish to override
some extra NSObject methods such as -retainCount; this is described
here:

<http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaFundamentals/CocoaObjects/chapter_3_section_10.html>

Larry

_______________________________________________ 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: shared instance and nstableview
      • From: "Lawrence Sanbourne" <email@hidden>
References: 
 >shared instance and nstableview (From: Yorh <email@hidden>)
 >Re: shared instance and nstableview (From: "Lawrence Sanbourne" <email@hidden>)

  • Prev by Date: Re: Does a NSView's bounds.size always equal to frame.size?
  • Next by Date: Re: Quit menu item undimming itself?!
  • Previous by thread: Re: shared instance and nstableview
  • Next by thread: Re: shared instance and nstableview
  • Index(es):
    • Date
    • Thread