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};
...
}