可可 – NSAttributedString与删除线

可可 – NSAttributedString与删除线,第1张

概述我试图通过删除线创建一个归因的字符串,但是,这个简单的任务似乎比我预期的要困难得多.这是我目前所在(这不工作).谢谢您的帮助! NSAttributedString *theTitle = [[[NSAttributedString alloc] initWithString:@"strikethrough text" attributes:[NSDictionary dictionaryWith 我试图通过删除线创建一个归因的字符串,但是,这个简单的任务似乎比我预期的要困难得多.这是我目前所在(这不工作).谢谢您的帮助!

NSAttributedString *theTitle = [[[NSAttributedString alloc] initWithString:@"strikethrough text" attributes:[NSDictionary dictionaryWithObjectsAndKeys:[NScolor whitecolor],NSForegroundcolorAttributename,NSUnderlinePatternSolID,NsstrikethroughStyleAttributename,nil]] autorelease];
解决方法 首先,NsstrikethroughStyleAttributename的值必须是NSNumber,而不是一个简单的整数.其次,我想你必须包括NSUnderlinestyleSingle:

...:[NSDictionary dictionaryWithObjectsAndKeys:      ...,[NSNumber numberWithInteger:NSUnderlinePatternSolID | NSUnderlinestyleSingle],nil]...
总结

以上是内存溢出为你收集整理的可可 – NSAttributedString与删除线全部内容,希望文章能够帮你解决可可 – NSAttributedString与删除线所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1028071.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-23
下一篇2022-05-23

发表评论

登录后才能评论

评论列表(0条)

    保存