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.backgr开发者_Python百科oundColor = [UIColor redColor];
[test.layer setBorderColor: [[UIColor blueColor] CGColor]]; //no '-setBorderColor:' method found
[test.layer setBorderWidth: 1.0]; //no '-setBorderWidth:' method found
[self addSubview:test];
Make sure to #import <QuartzCore/QuartzCore.h>
to the top of your file. That's where all of the CoreAnimation classes are defined.
精彩评论