Ios 如何在Xcode 5中重置按钮/标签

Ios 如何在Xcode 5中重置按钮/标签,ios,uibutton,Ios,Uibutton,我正在创建一个应用程序,你按下一个按钮,然后它会给你一个标签上的计数。然后我有一个按钮来清除信息 例如。如果我按下按钮WO,它将在标签“labelTwo”上添加“1”。用户按下按钮5次,标签WO将显示“5”。我点击“clearButton”,它会将其清除 我的问题是,在清除之后,如果我按下按钮2,labelTwo将不会在“1”处重新启动,而是在“6”处继续,就像我从未清除过一样 多谢各位 - (IBAction)buttonFour:(id)sender { self.four +=

我正在创建一个应用程序,你按下一个按钮,然后它会给你一个标签上的计数。然后我有一个按钮来清除信息

例如。如果我按下按钮WO,它将在标签“labelTwo”上添加“1”。用户按下按钮5次,标签WO将显示“5”。我点击“clearButton”,它会将其清除

我的问题是,在清除之后,如果我按下按钮2,labelTwo将不会在“1”处重新启动,而是在“6”处继续,就像我从未清除过一样

多谢各位

 - (IBAction)buttonFour:(id)sender {
    self.four += 1;
    [self.labelFour setText:[NSString stringWithFormat:@"%d", self.four]];
}

- (IBAction)buttonThree:(id)sender {
    self.three += 1;
    [self.labelThree setText:[NSString stringWithFormat:@"%d", self.three]];
}

- (IBAction)buttonTwo:(id)sender {
    self.two += 1;
    [self.labelTwo setText:[NSString stringWithFormat:@"%d", self.two]];
}

- (IBAction)buttonOne:(id)sender {
    self.one += 1;
    [self.labelOne setText:[NSString stringWithFormat:@"%d", self.one]];
}

- (IBAction)clearButton:(id)sender {
    self.clear = 0;
    [self.clearFour setText:[NSString stringWithFormat:@"%d", self.clear]];
    self.clear = 0;
    [self.clearThree setText:[NSString stringWithFormat:@"%d", self.clear]];
    self.clear = 0;
    [self.clearTwo setText:[NSString stringWithFormat:@"%d", self.clear]];
    self.clear = 0;
    [self.clearOne setText:[NSString stringWithFormat:@"%d", self.clear]];
    self.clear = 0;
    [self.clearTotal setText:[NSString stringWithFormat:@"%d", self.clear]];
}

- (IBAction)totalOne:(id)sender {
    self.oneTotal +=1; [self.total setText:[NSString stringWithFormat:@"%d", self.oneTotal]];
}

- (IBAction)totalTwo:(id)sender {
    self.oneTotal +=1; [self.total setText:[NSString stringWithFormat:@"%d", self.oneTotal]];
}

- (IBAction)totalThree:(id)sender {
    self.oneTotal +=1; [self.total setText:[NSString stringWithFormat:@"%d", self.oneTotal]];
}

- (IBAction)totalFour:(id)sender {
    self.oneTotal +=1; [self.total setText:[NSString stringWithFormat:@"%d", self.oneTotal]];
}

您需要在
clearButton:
方法中将
self.two的值设置回零。将此添加到您的
clearButton:
方法:

self.one = 0;
self.two = 0;
self.three = 0;
self.four = 0;
self.five = 0;