9
更新标题时如何防止UIButton闪烁
当我在UIButton上调用setTitle时,按钮在iOS 7中闪烁。我尝试设置myButton.highlighted = NO,但这并没有阻止按钮闪烁。 [myButton setTitle:[[NSUserDefaults standardUserDefaults] stringForKey:@"elapsedLabelKey"] forState:UIControlStateNormal]; myButton.highlighted = NO; 这是我设置计时器以更新标题的方式: - (void)actionTimer { if (myTimer == nil) { myTimer = [NSTimer scheduledTimerWithTimeInterval: 1.0 target: self selector: @selector(showActivity) userInfo: nil repeats: YES]; } } 这是实际更新标题的方法: - (void)showActivity { NSString *sym = [[NSLocale currentLocale] objectForKey:NSLocaleCurrencySymbol]; if (pauseInterval == nil) …