我需要将标签与CATextLayer相关联,所以我想这个:
·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];`
但是当我尝试构建它时,我有这个错误:
"_OBJC_CLASS_$_CATextLayer", referenced from:
objc-class-ref-to-CATextLayer in StructViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
有什么想法吗? :/
答案 0 :(得分:1)
您可能没有将QuartzCore和CoreText框架链接到您的项目。右键单击XCode中的Frameworks Group,然后执行add-&gt; Existing Frameworks ...选择QuartzCore和CoreText,你应该好好去!