<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Topic: Is this Singleton class correct? values don&#039;t change.</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/4944</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 01:46:46 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/topic/4944" rel="self" type="application/rss+xml" />

		<item>
			<title>crmagicxxx on "Is this Singleton class correct? values don&#039;t change."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4944#post-29521</link>
			<pubDate>Wed, 10 Mar 2010 14:04:29 +0000</pubDate>
			<dc:creator>crmagicxxx</dc:creator>
			<guid isPermaLink="false">29521@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I suppose your problem was with "alloc" but anyway, for the sake of other users that may encounter similar problems, you should always explain how you fixed your code
</p></description>
		</item>
		<item>
			<title>mack on "Is this Singleton class correct? values don&#039;t change."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4944#post-29494</link>
			<pubDate>Wed, 10 Mar 2010 09:15:41 +0000</pubDate>
			<dc:creator>mack</dc:creator>
			<guid isPermaLink="false">29494@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>never mind i fixed it
</p></description>
		</item>
		<item>
			<title>mack on "Is this Singleton class correct? values don&#039;t change."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4944#post-29491</link>
			<pubDate>Wed, 10 Mar 2010 08:46:07 +0000</pubDate>
			<dc:creator>mack</dc:creator>
			<guid isPermaLink="false">29491@http://www.cocos2d-iphone.org/forum/</guid>
			<description><pre><code>@interface DataManager : NSObject {

	int correctAnswers;
	int incorrectAnswers;

	int raceTime;
	int speed;
	int score;

}

@property(readwrite) int correctAnswers;
@property(readwrite) int incorrectAnswers;
@property(readwrite) int raceTime;
@property(readwrite) int speed;
@property(readwrite) int score;

+ (DataManager*)sharedData;

@end

#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;DataManager.h&#34;

@implementation DataManager
@synthesize score,speed,correctAnswers,incorrectAnswers,raceTime;

static DataManager *DataManager_Singleton = nil;

+(DataManager *)sharedData
{
	if (nil == DataManager_Singleton) {
		DataManager_Singleton = [[DataManager_Singleton alloc] init];
	}
	return DataManager_Singleton;

}

@end</code></pre>
<p>Whenever I type [[DataManager sharedData] setScore = 100] or any value in another class(cocos2d layer), it remains 0.
</p></description>
		</item>

	</channel>
</rss>

