在遵循this(添加渐变标签部分)教程时,我正在尝试使用FXlabel。这是我的viewDidLoad方法中的一些代码:

self.logoLabel = [[FXLabel alloc] initWithFrame:CGRectMake(14, 11, 280, 87)];

[logoLabel setFont:[UIFont boldSystemFontOfSize:45]];

[logoLabel setTextColor:[UIColor whiteColor]];
[logoLabel setShadowColor:[UIColor blackColor]];
[logoLabel setShadowOffset:CGSizeMake(0, 2)];
[logoLabel setTextAlignment:UITextAlignmentCenter];
[logoLabel setBackgroundColor:[UIColor clearColor]];
[logoLabel setText:@"Attorney Biz"];

[logoLabel setGradientStartColor:[UIColor colorWithRed:163.0/255 green:203.0/255 blue:222.0/255 alpha:1.0]];
[logoLabel setGradientEndColor:[UIColor whiteColor]];


不幸的是,倒数第二行出现错误"No visible @interface for 'UILabel' declares the selector 'setGradientStartColor'""No visible @interface for 'UILabel' declares the selector 'setGradientEndColor'"

有人可以解释如何消除这些错误吗?

最佳答案

检查头文件中的logoLabel声明,并将“ FXLabel.h”导入实现文件中。

@class FXLabel;
@interface SomeClass:SomeParentClass
{
    FXLabel *logoLabel;
}

@property (nonatomic, retain) FXLabel *logoLabel;

@end

10-08 15:42