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.

Motion effects

Motion effects

- [Instructor] You've seen motion effects as backgrounds on your home screen for your phone. Let's learn how to use motion effects that respond to tilt of the device. If you open your exercise file here, I've got several things done ahead of time. If you head down to where I am in ViewController ViewDidLoad, you'll see I've set up an ImageView with an image named Surfer Girl. Now, I made this image a scaleAspectFill contentMode. You can also use, for the center, if you wish for best results, use only these two. Others will give you some weird results. When making a background, you're going to want to start with the bounds of the image bigger than the bounds of the screen. So, I'm going to go a little further up here and I will set that in viewWillLayoutSubviews, and I use the insetBy method, which you can see right here, to do this with a negative value for the variable inset. And so, I've got here, inset set it…

Contents