开发者

Is possible to use CATextLayer in a c struct?

I need to associate a tag with a CATextLayer so I thought this:

.h

#import <QuartzCore/QuartzCore.h>
#import <CoreText/CoreText.h>

typedef struct textLayerWithTag
{
    CATextLayer *textLayer;
    int tag;
}textLayerWithTag;

.m`

textLayerWithTag textLayer1;

textLayer1.tag = 0;
textLayer1.textLayer = [[CATextLayer alloc] init];
textLayer1.textLayer.string = @"aaaa";
textLayer1.textLayer.frame = CGRectMake(0.f, 10.f, 320.f, 32.f);

[self.view.layer addSublayer:textLayer1.textLayer];`

But when I try to build it I hav开发者_如何学JAVAe this error:

"_OBJC_CLASS_$_CATextLayer", referenced from:
objc-class-ref-to-CATextLayer in StructViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Any ideas? :/


You probably aren't linking the QuartzCore and CoreText Frameworks to your project. Right click on the Frameworks Group in XCode and then do add->Existing Frameworks... Select QuartzCore and CoreText and you should be good to go!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜