how do I set a NSString using a value from a UILabel? so far i have this but it crashes:
NSString *theScore =[[NSString alloc]initWithFormat:@"%@",scoreX.text];
scoreX is a UILabel.
can anyone help? thanks in advance
how do I set a NSString using a value from a UILabel? so far i have this but it crashes:
NSString *theScore =[[NSString alloc]initWithFormat:@"%@",scoreX.text];
scoreX is a UILabel.
can anyone help? thanks in advance
Have you checked that neither scoreX nor scoreX.text is null? Otherwise this looks fine...
Assuming you're using Interface Builder, it sounds like you may have bound the 'scoreX' outlet to a wrong element that doesn't have the text property.
If not, posting the text of the crash would help.
Your given code is correct. you don't try some other way.
let you try this,
NSString *theScore =[NSString stringWithFormat:@"%@",[scoreX text]];