UISegmentedControl fading colors like Apple Music

In the new Apple Music app, I noticed that if you go to My Music, there is a UISegmentedControl that will disappear in the background and text colors of the selected index when scrolling between the library and playlists. How can I create the same effect? At the moment, I have the same setup with UIPageViewController and a UISegmentedControl , which changes the selected index to scroll.

+5
source share
1 answer

The way I can think of is to have another instance of the UISegmentedControl with the same configuration as the superimposed dummy, just for use as a transition effect. This mannequin must either be hidden or not displayed if not crossed.

Before moving on to another selected index, display the fiction with the target index and start with alpha = 0.

Proportional to scrolling, adjust dummy alpha accordingly. With a full transition, install the real instance with the target index and remove the fiction from the supervisor or hide it.

That should do the trick I think.

0
source

All Articles