I’ve added a button that I want to essentially toggle a label from “Hello World” to “Goodbye World”, right now it just says “Goodbye World” and doesn’t change….what am I doing wrong?
- (IBAction)button:(id)sender {
NSString *mystr = @"Hello World";
if (strcmp(label.text, mystr) == 0) {
label.text = @"Goodbye World";
}
else
{
label.text = @"Hello World";
}
//label.text = [NSString stringWithFormat:@"%d", strcmp(label.text, @"Hello World")];
}
Try this: