我已經添加了一個按鈕,我希望將標籤從「Hello World」切換到「再見世界」,現在它只是說「再見世界」並且不會改變....我在做什麼錯誤?新開發者...我的你好世界應用程序不工作。我的琴絃有什麼問題?
- (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")];
}
你最初在label.text中傳遞了什麼? – Sarah 2012-01-31 05:25:45
「繼續...按下我」,但它應該切換。標籤的起始位置無關緊要。 – 2012-01-31 05:26:23