我希望每次用户点击按钮时,其内部的数字增加1.以下是执行此操作的代码。但是我希望它在括号中,例如(1)当他们按下按钮变为(2)等时我该怎么做? 感谢
-(IBAction)passButton:(id)sender{
passCounter = passCounter + 1;
passLabel.text = [NSString stringWithFormat:@"%i",passCounter];
}
答案 0 :(得分:0)
passLabel.text = [NSString stringWithFormat:@"(%i)",passCounter];
答案 1 :(得分:0)
-(IBAction)passButton:(id)sender{
passCounter++;
passLabel.text = [NSString stringWithFormat:@"(%i)",passCounter];
}