Todd Davies
Todd Davies

Reputation: 5522

Errors in UILabel

I'm trying to use the FXlabel when following this (Adding a gradient label section) tutorial. This is some of the code inside my viewDidLoad method:

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, I get an error "No visible @interface for 'UILabel' declares the selector 'setGradientStartColor'" at the second-to-last line and "No visible @interface for 'UILabel' declares the selector 'setGradientEndColor'"

Can somebody explain how to remove these errors?

Upvotes: 0

Views: 748

Answers (2)

DanKiiing
DanKiiing

Reputation: 102

I solved this by changing

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

to this

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

after you add the FXLabel component. I was scratching my head for a while at the errors.

Upvotes: 0

tikhop
tikhop

Reputation: 2087

Check the logoLabel declaration in header file and import "FXLabel.h" in implementation file.

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

@property (nonatomic, retain) FXLabel *logoLabel;

@end

Upvotes: 2

Related Questions