I'm using NightNight to support a day and night theme of my app. For this, I subscribe to a Notification of NightNight, which informs me when the user changes the theme.
Inside the method being called I merely say secondSwitch.reloadData()
This secondSwitch has two segments: index 0 is always grey, index 1 is blue or orange, depending on the theme.
There's also a firstSwitch which shows none of the following problems!
Whenever I update the theme, the notification fires, and the following happens:
If segment at index 1 is currently selected, it switches from blue to orange or vice versa as it should!
If segment at index 0 is currently selected, it should simply stay grey. However it loses any colour! It simply gets clear/transparent. If I grab the thumb of the control and start to drag, it reappears grey! Also switching it and switching it back shows the proper colour.
Here's my delegate method:
`if segmentedControl.tag == 0 {
switch index {
case 1:
return [FlatYellow(), FlatYellowDark()]
case 2:
return [FlatNavyBlue(), FlatNavyBlueDark()]
default:
return [FlatSkyBlue()]
}
}
else if segmentedControl.tag == 1 {
switch index {
case 1:
if NightNight.theme == .normal {
return [FlatSkyBlue()]
}
return [FlatOrange()]
default:
return [FlatGrayDark()]
}
}
return [FlatSkyBlue()]
`
Here, secondSwitch has the tag 1, whilst firstSwitch has the tag 0.
I'd highly appreciate any tips as to what I do wrong! Thanks!
Hello,
I'm using NightNight to support a day and night theme of my app. For this, I subscribe to a Notification of NightNight, which informs me when the user changes the theme.
Inside the method being called I merely say secondSwitch.reloadData()
This secondSwitch has two segments: index 0 is always grey, index 1 is blue or orange, depending on the theme. There's also a firstSwitch which shows none of the following problems!
Whenever I update the theme, the notification fires, and the following happens:
If segment at index 1 is currently selected, it switches from blue to orange or vice versa as it should! If segment at index 0 is currently selected, it should simply stay grey. However it loses any colour! It simply gets clear/transparent. If I grab the thumb of the control and start to drag, it reappears grey! Also switching it and switching it back shows the proper colour.
Here's my delegate method:
`if segmentedControl.tag == 0 {
} else if segmentedControl.tag == 1 {
}
return [FlatSkyBlue()] `
Here, secondSwitch has the tag 1, whilst firstSwitch has the tag 0.
I'd highly appreciate any tips as to what I do wrong! Thanks!