Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 12-16-2008, 05:33 PM   #7 (permalink)
RickMaddy
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
RickMaddy will become famous soon enough
Default

This is telling you that CGRect is a C structure (struct) containing two fields - origin and size of type CGPoint and CGSize respectively. As it turns out each of these are also C structures (which you can tell by clicking on CGPoint or CGSize.

So yes, if you create a CGPoint object then you can just assign it to the 'origin' field of a CGRect object. Or you can just assign one of the CGPoint fields (x and y).

Code:
CGRect myRect;
CGPoint myPoint;
myPoint.x = 34.5;
myPoint.y = 12.0;
myRect.origin = myPoint;

// or you can do:
myRect.origin.x = 34.5;
myRect.origin.y = 12.0;
C Structures aren't classes. You don't allocate them.

Objective-C is a superset of C. If you aren't familiar with C then I suggest you pickup a decent book on learning C. Understanding the basics of C will make you a better Objective-C programmer.
RickMaddy is offline   Reply With Quote
 

» Advertisements
» Online Users: 388
15 members and 373 guests
Absentia, alisafl22, bbbsaha, DaveDee, dbramhall, erdinc27, fredidf, Hercule, heshiming, Johnsyfared, milanalina, prbiztech, roof44, waghman, wserver
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,603
Threads: 94,084
Posts: 402,782
Top Poster: BrianSlick (7,990)
Welcome to our newest member, alisafl22
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:00 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.