开发者

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

开发者 https://www.devze.com 2023-02-10 14:33 出处:网络
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

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.

0

精彩评论

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

关注公众号