sol
sol

Reputation: 6462

no '-setBorderColor:' method found on UIView layer?

I have the following code in two different classes (both subclasses of UIView). In one place it works fine, the border is drawn. In the other place I get warnings about methods not being found, and of course the border doesn't get drawn. How is this possible?

UIView* test = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100,100)];
test.backgroundColor = [UIColor redColor];

[test.layer setBorderColor: [[UIColor blueColor] CGColor]]; //no '-setBorderColor:' method found 
[test.layer setBorderWidth: 1.0];  //no '-setBorderWidth:' method found 

[self addSubview:test];

Upvotes: 8

Views: 3924

Answers (1)

Carter Allen
Carter Allen

Reputation: 1984

Make sure to #import <QuartzCore/QuartzCore.h> to the top of your file. That's where all of the CoreAnimation classes are defined.

Upvotes: 20

Related Questions