RTLabel常见的设置标签

在我们应用中,经常会用到带下划线的label,比如“找回密码”。网上查了一下,RTLabel是一个非常不错的库。这里说一下使用:1.将RTLabel.h 和 RTLabel.m直接拽入你的工程中;2.引入 CoreText.framework;3.初始化和使用:    RTLabel *forgotLb = [[RTLabel alloc] initWithFrame:CGRectMake(LINK_LABEL_x, LINK_LABEL_Y+10,                                                                  LINK_LABEL_WIDTH+100, LINK_LABEL_HEIGHT)];    forgotLb.text = @"Forgot password";    forgotLb.delegate = self;    forgotLb.userInteractionEnabled = YES;    [_accountView addSubview:forgotLb];复制代码这里是一个链接,代理方法是用来实现点击效果,代码如下:- (void)rtLabel:(id)rtLabel didSelectLinkWithURL:(NSURL*)url{    LOG(@"Forgot password");}复制代码下面是一些常用标签Bold//加粗Italic//斜体Bold & Italic//同时加粗斜体underline//下划线underline with color// 下划线和颜色link//链接double underline//双下划线double underline with color//双下划线和颜色custom font//自定义字体大小的颜色custom font with strokes//空心的字体custom font with kerning//可以调整字之间的间距

alignment

//单词两端对齐

indentation

//文本缩进

你可能感兴趣的:(RTLabel常见的设置标签)