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
406 views
in Technique[技术] by (71.8m points)

iphone - Property cannot be found on forward class object?

I have a UIView and I'm trying to set its layer properties.

self.colorSwatch = [[UIView alloc] initWithFrame:CGRectMake(400, 150, 100, 100)];
self.colorSwatch.layer.cornerRadius = 8; 

However, when I try to access the .layer.cornerRadius property, I get a warning that says "Property 'cornerRadius' cannot be found in forward class object 'CALayer *'.

What does this mean? Thanks

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

It doesn't know what type of object the layer property is. Add #import <QuartzCore/QuartzCore.h> to the top of your file.


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

...