From the course: Advanced iOS App Development: Core Animation
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution - iOS Tutorial
From the course: Advanced iOS App Development: Core Animation
Solution
(sweeping music) - [Instructor] All right, let's start off by creating a new function, and we're going to call this func createTextLayer. Now, inside here, we're just going to create a new variable, called titleLayer, and this is going to be of type CATextLayer. Just like with the replicator, we need to specify a frame and set up its properties. We'll say titleLayer.frame = a new CGRect, and we're going to have this be x at the 0 position, y is 100, width is going to be AnimationHelper.screenBounds.width, and height of 100. This is going to fill most of the top part of the screen. Now we can also set the titleLayer.string property, I'm just going to give this a string "Dashboard." Finally, I want the text to be centered, so I'm going to say titleLayer.alignmentMode = "center." Now that's left is to add this new textLayer to the main view and run the app to make sure this looks right. Can't forget to go up to viewDidAppear and underneath our createReplicatorLayer, just call…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.