Core Animation help, CATextLayer.

Discussion in 'Mac Programming' started by ausername, Apr 24, 2009.

  1. ausername macrumors newbie

    Feb 28, 2009
    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, :)
  2. ausername thread starter macrumors newbie

    Feb 28, 2009

    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.
  3. gnasher729 macrumors P6


    Nov 25, 2005
    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.
  4. ausername thread starter macrumors newbie

    Feb 28, 2009
    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.

Share This Page