0

I am trying to complete the following task and hit a road block. I am trying to mimick this image I created in an image editor, using a label in swift, and I can't find a suitable way to mimick the color schematics.

The idea is that I have a label with a blue text color. Behind it, I have a gradient of a blue series. I am trying to figure out a way that I can determine as soon as my label crosses over the edge of the background gradient, and change the color respectively.

For example, in image1, you can see how the text color changes as the gradient are diminished. Image2 is my work, and I can only get to have the first portion correctly masked. I tried masking the entire label to a background gradient, but that only allows for a single gradient and does not account for when the progress bar behind it terminates.

Image 1:

enter image description here

Image 2:

image2

nathan
  • 9,329
  • 4
  • 37
  • 51
Jstngoulet
  • 1,055
  • 7
  • 12
  • Add your word done so that we extend from there. – dahiya_boy Sep 05 '17 at 03:52
  • Indeed, the duplicate question has the answer the OP wants regarding the bg-dependant, "inverted" text color. In order to have a separeate background/gradient for the "unfilled" portion on the right side (gray in the screenshot), he could use either a subview hierarchy or perhaps (more elegantly) add additional sublayers to the label... – Nicolas Miari Sep 05 '17 at 05:44

0 Answers0