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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 02-02-2010, 10:27 AM   #10 (permalink)
yoichi
Registered Member
 
Join Date: Oct 2009
Posts: 5
Default

I had a similar problem as I am new to Objective-C. As others are saying, it is the same as the normal C but one difference. That is, you can use them as you expect, but not with Objective-C specific things.

I figured out that C variable initializers can be used in the class interface, too, but not between @interface and the {...} or within the "{...}".

Otherwise they can be declared as you do with normal C header files. They can be also declared outside the block surrounded by an @interface and the paring @end.

E.g. This is OK and the emptyCoordinate can be used in the @implementation:

Code:
@interface ...
{
 ...
}

static const CLLocationCoordinate2D emptyCoordinate = {-1.0, -1.0};

@property ...
...
...
@end

@implementation ...

@synthesize myCoord;

- (void)viewDidLoad
{
   myCoord = emptyCoordinate;
   ...
}

@end
Or:

Code:
static const CLLocationCoordinate2D emptyCoordinate = {-1.0, -1.0};
@interface ...
...
@end
Or:

Code:
- (void)viewDidLoad
{
   ...
   CLLocationCoordinate2D emptyLoc = {-1.0, -1.0};
   ...
}
yoichi is offline   Reply With Quote
 

» Advertisements
» Online Users: 312
21 members and 291 guests
ADY, apatsufas, dacapo, Fit4him, headkaze, HemiMG, ilmman, iosdevjtp, leahov, MarkC, marto1914, morands, PsychoChris, sly24, sneaky, Sunny46, tgjorgoski, thh022, Thrillhouse1919, timle8n1, vogueestylee
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,877
Threads: 89,222
Posts: 380,718
Top Poster: BrianSlick (7,129)
Welcome to our newest member, peterkessler45
Powered by vBadvanced CMPS v3.1.0

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