Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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];
like image 556
sol Avatar asked Feb 11 '11 23:02

sol


1 Answers

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

like image 83
Carter Allen Avatar answered Sep 22 '22 05:09

Carter Allen