这是我与Objective C的第一天,我每次触摸按钮时都会尝试打印空间。非常感谢。
#import "ViewController.h"
@interface ViewController()
@end
@implementation ViewController
@synthesize display = _display;
-(IBAction)trickClicked:(UIButton *)sender{
NSString *trick = [sender currentTitle];
UILabel *myDisplay = self.display;
NSString *currentText = myDisplay.text;
NSString *newText = [currentText stringByAppendingString:trick];
myDisplay.text = newText;
}
@end
答案 0 :(得分:1)
试试这个:
// NSString *newText = [currentText stringByAppendingString:trick];
NSString *newText = [NSString stringWithFormat: @"%@ %@", currentText, trick];