Weird behavior with UISegmentedControl and UIAppearance

前端 未结 1 2059
醉话见心
醉话见心 2021-02-10 02:41

I am setting the appearance of the segmented control via these statements in the app delegate.

    [[UISegmentedControl appearance] setBackgroundImage:[[UIImage         


        
相关标签:
1条回答
  • 2021-02-10 03:13

    This is a bug with UISegmentedControl, I think. You can work around it by setting the selected segment after a delay, to allow the control time to draw itself. You don't even have to use an actual delay, just something like:

    [self performSelector:@selector(setPreferences) withObject:nil afterDelay:0.0];
    

    Where setPreferences updates the value of your segmented control.

    0 讨论(0)
提交回复
热议问题