1,
if (flag == SUCCESS_FLAG)
{
[self.passwordButtonsetTitle:@"已发送"forState:UIControlStateNormal];
secontNum = 60;
self.passwordButton.tag = 110;
myTimer = [NSTimerscheduledTimerWithTimeInterval:1.0target:selfselector:@selector(sixtyCount:) userInfo:nilrepeats:YES];//使用timer定时,每秒触发一次
}
2,
-(void)sixtyCount:(id)sender
{
[self.passwordButtonsetTitle:[NSStringstringWithFormat:@"%d秒",secontNum] forState:UIControlStateNormal];
if (secontNum == 0) {
[self.passwordButtonsetTitle:[NSStringstringWithFormat:@"重新发送"] forState:UIControlStateNormal];
[myTimer invalidate];
self.passwordButton.tag = 120;
}
secontNum --;
}