From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 23,200 courses taught by industry experts.

Practical CGRects

Practical CGRects

- [Instructor] Last week, I set up what you need to make a drawing environment playgrounds for UIkit. This week, we'll finish getting the drawing environment together by using a critical struct in Core Graphics and that's the CGRect. We've added a few to get something on the preview but it isn't quite right yet. We're going to define these rects better and use some of the common techniques on them. So I'm going to start down here in loadView. So let's scoot this up a bit and we've got this view.frame here, which I'm actually going to just cut this part out and delete the rest of this because there's another way of doing that and that is directly in the UIView. You can initialize these with frames. So I'm going to put the frame here and I'm just going to put that CGRect in here. Now, frames are where you place and size the rectangle in the superviews coordinate system. So you're using an initialize frame like I did…

Contents