How to prevent UIButton from flashing when updating the title

前端 未结 9 1025
旧巷少年郎
旧巷少年郎 2021-01-30 04:41

When I call setTitle on a UIButton, the button flashes in iOS 7. I tried setting myButton.highlighted = NO, but that didn\'t stop the button from flashing.

[myBu         


        
9条回答
  •  囚心锁ツ
    2021-01-30 05:39

    See the responses from How to stop unwanted UIButton animation on title change? :

    [UIView setAnimationsEnabled:NO];
    [elapsed setTitle:[NSString stringWithFormat:@"%.2i:%.2i:%.2i:%.2i",days,hours,minutes,seconds] forState:UIControlStateNormal];
    [UIView setAnimationsEnabled:YES];
    

提交回复
热议问题