O'Reilly logo

The Complete Idiot's Guide® To iPad and iPhone App Development by Troy Brant

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Core Graphics

To move a view, you need to either set its center property—a CGPoint type—or set its frame property—a CGRect type. These types are defined in the Core Graphics framework, a framework that provides the basic building blocks for drawing and positioning views. Views use three data types from Core Graphics to determine their shape and size: CGPoint, CGSize, and CGRect.

CGPoint, CGSize, and CGRect

If someone asked you to draw a box, you would need to know at least two pieces of information about it: where it goes and what size it is. In Core Graphics, to specify the where, you use CGPoint. To specify what size, you use CGSize. And to specify both where and what size, you use CGRect.
ONE MORE THING
The CG prefix is short for Core ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required