字体与罢工通过它 [英] Font With Strike through it
问题描述
我正在做一个处理当天任务的项目,比如记笔记。
所以我分配每日任务,当任务完成时,我想通过任务名称进行一次线路攻击。 />
我正在搜索具有此删除线但却失败的相应字体系列。
所以请为我建议一个.ttf字体名称,以便我可以使用该字体在我的项目中,以满足我的要求。
I am doing one project of handling task of the day like taking notes.
So I assign daily task to do and when task is done I want one line strike through the task name.
I am searching for the appropriate font-family that has this strike-through line but failed.
so please suggest me a .ttf font name for that so I can use that font in my project to fulfill my requirement.
推荐答案
****** OPTION 1 ******
******OPTION 1******
。
如果您想在多行模式中浏览文本:使用 TTTAttributedLabel
If You want to strike through text in multiline mode: use TTTAttributedLabel
创建新的TTTAttributedLabel.h和TTTAttributedLabel.m文件(不是来自GITHUB,因为我调整了单/双删除线功能)
create new TTTAttributedLabel.h and TTTAttributedLabel.m files (not from GITHUB, because I tweaked with single/double strikethrough feature)
http://www.2shared.com/file/Z_qZpWVd/TTTAttributedLabel.html
http://www.2shared.com/file/xXjmC-1M/TTTAttributedLabel.html
以及需要删除标签的地方 -
使用 TTTAttributedLabel 而不是 UILabel 。
and where you need a strikethrough label - use TTTAttributedLabel instead of UILabel.
设置删除 =
TTTAttributedLabel *labelName = [[TTTAttributedLabel alloc] init];
labelName.linkAttributes = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]
forKey:@"TTTCustomStrikeOut"];
设置 doublethrough =
TTTAttributedLabel *labelName = [[TTTAttributedLabel alloc] init];
labelName.linkAttributes = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]
forKey:@"TTTCustomDoubleStrikeOut"];
添加标签文本应被删除的范围+提供可点击链接(无,无链接):
Add range where label text should be striked out + provide clickable link (nil , for no link):
//set link to nil, to NOT-have a link on taping on this label.
[labelName addLinkToURL:nil withRange:NSMakeRange(0, [labelName.text length])];
P.S。 - 要正确地重新定位双删除线 - 请编辑TTTAtributedLabel.m文件,在483,484和489,490行(目前我改变了上线y-2并从中心更低了y + 2.调整以获得更好的结果。)
P.S. - to properly reposition double strikeout lines - please edit TTTAtributedLabel.m file, at lines 483, 484 and 489, 490 (currently I changed upper line y-2 and lower y+2 from center. tweak that for better results.)
。
****** OPTION 2 ******
******OPTION 2******
。
将所有字符串符号转换为特殊的删除字符。
Convert all string symbols to special strike-through characters.
您可以从这个主页获取它们: http:// adamvarga.com/strike/
You can get them from this homepage: http://adamvarga.com/strike/
然后您可以 - 例如,将必要的符号翻译放在语言文件中:
Then You can - for example, put necessary symbol translations in language file:
A=A̶;
B=B̶;
C=C̶;
D=D̶;
E=E̶;
F=F̶;
G=G̶;
H=H̶;
....
"A" = "A̶"; "B" = "B̶"; "C" = "C̶"; "D" = "D̶"; "E" = "E̶"; "F" = "F̶"; "G" = "G̶"; "H" = "H̶"; ....
并使用此函数将普通文本字符串转换为删除字符串:
and use this function, to turn normal Text string to striked out string:
- (NSString *)returnStrikedOutTextFromString:(NSString *)mString
{
NSString * mNewString = @"";
for(int i = 0; i<[mString length]; i++)
{
mNewString = [NSString stringWithFormat:@"%@%@",mNewString,
NSLocalizedString([[mString substringToIndex:i+1] substringFromIndex:i],nil)];
}
return mNewString;
}
例如:
textLabel.text = [self returnStrikedOutTextFromString:@"string text"];
****选项3 ****
****OPTION 3****
我还建议尝试这里提到的这个UILabel子类: UIlabel中的下划线文本
I would also suggest trying this UILabel subclass mentioned here: Underline text in UIlabel
希望有所帮助!
这篇关于字体与罢工通过它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!