更新标题时如何使按钮停止闪烁

时间:2014-05-16 16:21:13

标签: ios objective-c

我有一个按钮作为计时器。当它通过更改按钮的标题更新时间时,按钮闪烁。但是,如果我在没有按钮的情况下将计时器放在标题视图中并更新headerLabel的文本,它就不会闪烁。我可以对按钮做什么,以便在更新标题时不闪烁吗?

-(void)countdownTime:(NSTimer *)timer

{
    self.minutes = self.secondsRemaining / 60;
    self.stringMinutes = [NSString stringWithFormat:@"%i", self.minutes];
    self.seconds = self.secondsRemaining - (self.minutes * 60);
    self.stringSeconds = [NSString stringWithFormat:@"%i", self.seconds];
    if (self.seconds < 10) self.stringSeconds = [NSString stringWithFormat:@"0%i", self.seconds];
    self.time = [NSString stringWithFormat:@"%@:%@", self.stringMinutes, self.stringSeconds];

    self.secondsRemaining += 1;

      [self.delegate updateTimerButton:self.time];


}

按钮闪烁

- (void) updateTimerButton:(NSString *) sender {

    [self.timerButton setTitle: [NSString stringWithFormat:@"%@", sender] forState: UIControlStateNormal];

HeaderView不会闪烁

 [self.headerLabel setText: [NSString stringWithFormat:@"%@", self.time]];

1 个答案:

答案 0 :(得分:3)

将按钮的类型更改为“自定义”。您描述的行为是“系统”按钮的默认行为。

相关问题