开发者

Objective-C – Undefined symbols

开发者 https://www.devze.com 2023-04-05 13:08 出处:网络
I\'m trying to use a gradient in cocoa touch. I\'m using the following code for this: #import <QuartzCore/QuartzCore.h>

I'm trying to use a gradient in cocoa touch. I'm using the following code for this:

#import <QuartzCore/QuartzCore.h>

CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = mainView.bounds;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor blackColor] CGColor], (id)[[UIColor whiteColor] CGColor], nil];
[main开发者_JS百科View.layer insertSublayer:gradient atIndex:0];

But I get the following error when I try to compile:

Undefined symbols for architecture i386:

"_OBJC_CLASS_$_CAGradientLayer", referenced from: objc-class-ref in OfficeViewController.o ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status

I've tried to do a clean to no avail. Not really sure what else I can do?


Make sure you actually included the QuartzCore framework in your project. It should be in the Link Binary With Libraries phases:

Objective-C – Undefined symbols


Have you included the QuartzCore framework to the project as well? Just adding the headers is not enough.

0

精彩评论

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