Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
260 views
in Technique[技术] by (71.8m points)

iphone - Can't compile code when working with CALayer

For some reason I get linker errors when I try and use CALayer:

  "_OBJC_CLASS_$_CALayer", referenced from:

I have imported the following headers:

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>

Code:

arrowImage = [[CALayer alloc] init];
question from:https://stackoverflow.com/questions/2968071/cant-compile-code-when-working-with-calayer

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Make sure you also add the QuartzCore framework to your target. Just importing the header isn't enough.

XCode Screenshot enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...