What is this button artifact when choosing a UIButton?

I am trying to make a UI button a toggle button using this code:

- (void)tapButton:(id)sender{ UIButton *button = sender; if (!button.selected){ [self performSelector:@selector(highlight:) withObject:button afterDelay:0.0]; }else{ [self performSelector:@selector(removeHighlight:) withObject:button afterDelay:0.0]; } } - (void)highlight:(UIButton *)button{ button.selected = !button.selected; button.highlighted = YES; } - (void)removeHighlight:(UIButton *)button{ button.selected = !button.selected; button.highlighted = NO; } 

However, I get a strange artifact when the button is in the selected mode.

Not chosen:

enter image description here

marked:

enter image description here

+4
source share
1 answer

Just enter the button type "custom" instead of "system". I guess this weird bug is due to the new Tint feature on iOS7. This is probably a mistake, because the title property is an empty string @ "".

+4
source

Source: https://habr.com/ru/post/1491762/


All Articles