这段代码没有错误,但是当我单击按钮时,“if”语句中的任何内容都不起作用!它不会崩溃或显示错误...顺便说一句,我在 iPhone 应用程序上的 Xcode 中工作。
#import "MainView.h"
@implementation MainView
@synthesize MyButton2, MyMainTextLabel;
@synthesize MyButton3, MyMainTextLabel;
@synthesize MyButton2, Button2Label;
@synthesize MyButton2, Button3Label;
@synthesize MyButton3, Button2Label;
@synthesize MyButton3, Button3Label;
- (IBAction)Button2click {
if(Button2Label.text == @"Hello There!") {
MyMainTextLabel.text = @"\"Hey...!!\"";
Button3Label.text = @"What a rude Penguin!";
Button2Label.text = @"Hows a Goin?";
}
}
- (IBAction)Button3click {
if(Button3Label.text == @"Penguins SUCK!") {
MyMainTextLabel.text = @"\"DONT TEST ME!!\"";
Button3Label.text = @"Oh I Will!";
Button2Label.text = @"Sorry I didnt mean to...";
}
}
- (IBAction)buttonclick {
}
@end