【问题标题】:no '-setBorderColor:' method found on UIView layer?在 UIView 层上找不到“-setBorderColor:”方法?
【发布时间】:2011-02-11 23:38:18
【问题描述】:

我在两个不同的类(UIView 的两个子类)中有以下代码。在一个地方它工作正常,边界被绘制。在另一个地方,我收到有关未找到方法的警告,当然也没有绘制边框。这怎么可能?

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];

【问题讨论】:

    标签: objective-c ios uiview core-animation


    【解决方案1】:

    确保#import <QuartzCore/QuartzCore.h> 位于文件顶部。这是定义所有 CoreAnimation 类的地方。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-02-24
      • 2017-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-31
      相关资源
      最近更新 更多