NSString not applying to UILabel

Posted by lyonjtill on Stack Overflow See other posts from Stack Overflow or by lyonjtill
Published on 2010-04-19T01:38:04Z Indexed on 2010/04/19 1:43 UTC
Read the original article Hit count: 356

- (void)restoreUserDefaults {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if([defaults objectForKey:@"Exam Name"] == nil) {
    examName = [[NSString alloc] initWithString:@"Name"];
} else {
    examName = [[NSString alloc] initWithString:[defaults objectForKey:@"Exam Name"]];
}
[examNameLabel setText:examName];
NSLog(@"New Exam Schedule - Exam Name - %@",[defaults objectForKey:@"Exam Name"]);
NSLog(@"examName = %@", examName);
NSLog(@"examNameLabel = %@", examNameLabel);

}

Dear all,

Basically above is a basic method to change a UILabel to a saved piece of data.

I am having a problem making the label change to the NSString examName.

I have checked Interface Builder and it's connected up.

Any ideas why?

Regards

Lyon J Till

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa-touch