PDA

View Full Version : Get label value and check whether equal to some string




RutgerB
Mar 27, 2009, 05:20 PM
Hi


I have a label called currentInput. I want to get the value of the label and check whether it is equal to e.g. "hello".

I hope I've provided enough information.. I'm new to iPhone developement (I do have a lot of experience with Java and C)


Thanks

Rutger Bevers



Jeremy1026
Mar 27, 2009, 05:36 PM
if ([currentInput.text isEqualToString:@"Hello"]) {
NSLog(@"Match");
}
else {
NSLog(@"No Match");
}

RutgerB
Mar 27, 2009, 05:40 PM
This gives an error:

Request for member 'text' in something not a structure or an union.

I assume the code is right, but something else is wrong with my application.
Any idea?

Fixed it
In the header file:
IBOutlet id currentInput; had to be IBOutlet UITextField *currentInput;