title: Singleton class in cocos2d. Access to variable
body: <p>I have a problem with access to property of my Singleton Class. 
  I have wrote this code: Singleton.h - </p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  @interface Singleton : NSObject{
      int _wordNumber;
  }
  + (Singleton *) sharedSingleron;
  @property (readwrite) int wordNumber;
  @end
  </code></pre>
  
  <p>Singleton.m file - </p>
  
  <pre><code>#import "Singleton.h"
  @implementation Singleton
  @synthesize wordNumber = _wordNumber;
  
  
  static Singleton* _sharedSingleton = nil;
  
  +(Singleton *) sharedSingleron{
      @synchronized([Singleton class])
      {
          if (!_sharedSingleton)
              [[self alloc] init];
  
          return _sharedSingleton;
      }
  
      return nil;
  }
  +(id)alloc
  {
      @synchronized([Singleton class])
      {
          NSAssert(_sharedSingleton == nil, @"Attempted to allocate a second instance of a singleton.");
          _sharedSingleton = [super alloc];
          return _sharedSingleton;
      }
  
      return nil;
  }
  
  -(id)init {
      self = [super init];
      if (self != nil) {
  
      }
  
      return self;
  }
  
  
  @end
  </code></pre>
  
  <p>In my First scene I set the wordNumber and go to another scene</p>
  
  <pre><code>[Singleton sharedSingleron].wordNumber = wordNum;
  [[CCDirector sharedDirector] replaceScene: [CCTransitionFlipAngular transitionWithDuration:0.3 scene:[WordsLayer node]]];
  </code></pre>
  
  <p>and in WordsLayer.m I try to get this property </p>
  
  <pre><code>-(id) init
  {
      if( (self=[super init])) {
  
          int wordNum = [Singleton sharedSingleron].wordNumber;
  
      }
      return self;
  }
  </code></pre>
  
  <p>But wordNum have wrong value. please help me to find a mistake.</p>