Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

natanavra

macrumors newbie
Original poster
Dec 26, 2008
11
0
Hi,
I'm building a simple game and I wish to implement a statistics view, with best player name and score, In one of the views the user is asked for his name and and from there I save it to the user Defaults.
Later on I wish to change the label text in the statistics view to the text which I saved earlier in the user defaults, every time I try to change the label's text it stays empty...
if it matter I implemented the whole interface through interface builder and linked it up (I use 'initWithNibName:').
every view has a view.m/h viewController.h/m and a nib...
here's my code...
Code:
NSString *name = [[NSString alloc] initWithString:self.LoginViewController.Name.text];
	[[NSUserDefaults standardUserDefaults] setObject:name forKey:@"pName"];
	[[NSUserDefaults standardUserDefaults] synchronize];
	[StatisticsViewController updatePlayerName:name];
	[name release];


Code:
-(void)updatePlayerName: (NSString *)Name {
	[playerName setText:Name];
}

~Thanks in advance.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.