Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ausername

macrumors newbie
Original poster
Feb 28, 2009
25
0
The following line of code returns the error "error: syntax error before 'CATextLayer"...

@interface core : NSView {
CATextLayer *textLayer = [CATextLayer layerWithText:mad:"Hello" fontSize:25];
}


I am importing <Coaco/Cocoa.h>

How can I fix this problem and use CATextLayer in my program, any help would be great. Thanks, :)
 
Cocoa*

I also tried just using CATextLayer *aLayer;

But this also returns an error, and I don't understand why considering I got CATextLayer from an apple example. Any info would be good, thanks.
 
The following line of code returns the error "error: syntax error before 'CATextLayer"...

@interface core : NSView {
CATextLayer *textLayer = [CATextLayer layerWithText:mad:"Hello" fontSize:25];
}

You are declaring the interface for "core" which is a subclass of NSView. The @interface part between { } is for member variables of "core" objects. Between the closing } and @end you would declare class methods and object methods.

The implementation of those methods would be in an @implementation section.

I think you better go through some sample code and learn a bit more about Objective-C first.
 
I only included the @interface because I wanted to show that I was using NSView. I also figured it out, I had to import <Quartz/Quartz.h>

It works now.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.