I have some code here but it’s not working. What I want is to check when the UILabel shows something, example:
if(label.text=@"3"{
NSLog(@"Label showing three");
}
Any help appreciated,
Seb
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The only way a label can have a “3” (or any text) is if your program puts it there somehow. You should never need to test the contents of a label — test for the condition that would lead to the label having the value you’re interested in. More generally, a well designed program uses views to display the state of the program, it doesn’t store the state of the program in its views.
If you’re really bent on testing a label, though, every label has a
textproperty that will give you its value.