I want to change background color of text with animation. Does any way exist to set NSAttributedStringKey.backgroundColor
with duration time?
I mean in Hello my dear friend , how are you ?
I want to change the background color of friend
to yellow color with 2s (second)
Asked
Active
Viewed 92 times
0
-
You have to set yourself a timer/animation. – Larme Oct 31 '17 at 09:35
1 Answers
0
Unless you want to change only part of the NSAttributedString
Did you try (Swift 3) the following?
UIView.animate(withDuration: 0.3) {
label.backgroundColor = .red
}
That works for the whole label...

DanielH
- 685
- 5
- 6
-
I don't want change background color for all characters , I want to change only some characters , for instance change bgColor for char 0 to 5 – AzAli Oct 31 '17 at 09:18