开发者

Subclassing a UILabel, Given a Warning

I have the following at the top of one of my UIViewControllers.m:

@implementation UILabel (Custom)
-(void)setTitleLabelColor
{
UIColor *titleColor = [UIColor colorWithRed:1 green:0.90196 blue:0 alpha:1.0];

self.textColor = titleColor;

}

@end

I basically want to have a method that makes the text color to yellow.

When I call that function, it always gives me a warning, saying the UILabel might not respond to it, but it works fine.

How can I get rid of the warni开发者_开发问答ngs?


You should also declare this in your header (.h) file. For example,

@interface UILabel (Custom)
-(void)setTitleLabelColor;
@end

Then #import this from another file when you want to use that method.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜