2012-07-25 29 views
0

我試圖在使用this(添加漸變標籤部分)教程時使用FXlabel。這是一些代碼我viewDidLoad方法中:UILabel中的錯誤

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

Unfortnuately,我在第二到最後一行得到一個錯誤"No visible @interface for 'UILabel' declares the selector 'setGradientStartColor'""No visible @interface for 'UILabel' declares the selector 'setGradientEndColor'"

有人可以解釋如何消除這些錯誤?

+0

你有沒有#import「FXLabel.h」? – 2012-07-25 13:22:30

+0

是在我的.h文件中,我做過 – 2012-07-25 13:28:39

回答

2

檢查頭文件中的logoLabel聲明並在實現文件中導入「FXLabel.h」。

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

@property (nonatomic, retain) FXLabel *logoLabel; 

@end 
+0

這是頭文件中的UILabel。咄! – 2012-07-25 13:30:05

0

我改變

@property (nonatomic, strong) IBOutlet UILabel* logoLabel; 

這個

@property (nonatomic, strong) IBOutlet FXLabel* logoLabel; 

您添加FXLabel組件後解決了這個。我在錯誤處摸了一下頭。