From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Drop shadows

Drop shadows

- [Instructor] User interfaces often use drop shadows to make them look less flat, but it isn't obvious how to add one to a view on your app. In this tip, I'll show you how to make drop shadows using the CA layer found in UI Views and a few tricks with them. I've set up a quick starter file with two buttons on the main storyboard. You can download this from the exercises. I set up several actions for these buttons we'll use in our demos as you'll see here in the view controller. Now all UI Views have a special property layer of type CA layer. The layer property is great for many quick special effects, some of them built-in. Drop shadows are one of those built-in effects. You'll find I've put together a little basic drop shadow method in the code here so scroll over there and all it does is it takes a button and adds the drop shadow effects to it. There are four basic properties I'm going to add. So the way you do this is you're going to actually put the button in first, call its CA…

Contents