【发布时间】:2011-06-14 04:16:22
【问题描述】:
我有一个 IBAction,可以将某些按钮上的按下内容显示到 UILabel。我有另一个用于 equalPressed 按钮的 IBAction,它可以做很多事情,但我还添加了 titleDisplay.text = nil;它第一次完美运行。然后在我按下 equalPressed 按钮后,它不会出现。我知道这是因为我将 titleDisplay.text 设置为 nil。但是,我不知道如何使用 equalPressed 按钮清除 UILabel,以便我的其他按钮可以显示在屏幕上而无需不断附加
第一个 IBA 操作
- (IBAction) titleLabel: (UIButton *) sender {
NSString *titleOfButton = [[sender titleLabel] text];
titleDisplay.text = [[titleDisplay text] stringByAppendingString: titleOfButton];
}
第二次IBA操作
- (IBAction) equalPressed: (UIButton *) sender {
titleDisplay.text = nil;
}
【问题讨论】:
标签: iphone objective-c