所以,我刚开始学习Objective-C,就遇到了这个“自我”的东西。我只使用过 C,但我认为它也可能在 java 中使用过?有人可以解释吗?这是一个例子:
- (IBAction)digitPressed:(UIButton *)sender
{
NSString *digit = [sender currentTitle];
UILabel *myDisplay = [self display]; //why this?
}
为什么不只是这个?
- (IBAction)digitPressed:(UIButton *)sender
{
NSString *digit = [sender currentTitle];
UILabel *myDisplay = display; //why not like this?
}
显示是一个 UILabel *