user516883
user516883

Reputation: 9388

iOS Xcode storyboard: How do I make text look like this design

I have built this app from our designer, and we are finishing it up but I am not sure how to adjust this image in xcode storyboard of the On and Off text to look like the one in the design. I tried changing the shadow, but that just makes it darker. I am just using a standard label and it just comes in black.

enter image description here

Upvotes: 2

Views: 205

Answers (1)

Westside
Westside

Reputation: 685

Wire up your label to your code as an outlet in the usual way and then add the following to each:

OFF_Button.shadowColor = UIColor(red: 0, green: 60, blue: 120, alpha: 0.3)
OFF_Button.shadowOffset = CGSizeMake(1.5,1.5)

Where OFF_Button is the name of your label.

That will get you this:

enter image description here

You can tweak the offset, RGB values and alpha to get the exact style that your designer is looking for.

Obviously, if you've got multiple labels in your project that all want to have the same appearance then it makes sense to create a label subclass with this appearance built in.

Alternatively, if you want to do it all in storyboard then you can make a duplicate label, same text, different colour and then align it with the original label, but add a small value (probably between 1 and 2) to the 'constant' value in the alignment boxes under the size inspector. Moving this offset label to the back will give you the same effect. As is usually the case, the programatic route seems tidier.

Upvotes: 2

Related Questions