gpt4 book ai didi

ios - iOS 7 SDK 中 UILabel 的凸版效果

转载 作者:可可西里 更新时间:2023-11-01 06:18:28 27 4
gpt4 key购买 nike

在 WWDC 2013 视频中,他们展示了开发人员可以在文本上使用凸版效果。有没有人有关于如何使用 UILabel 执行此操作/如何执行此操作的示例代码?

最佳答案

他们现在使它变得非常简单。

//Use any font you want or skip defining it
UIFont* font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];

//Use any color you want or skip defining it
UIColor* textColor = [UIColor blueColor];

NSDictionary *attrs = @{ NSForegroundColorAttributeName : textColor,
NSFontAttributeName : font,
NSTextEffectAttributeName : NSTextEffectLetterpressStyle};

NSAttributedString* attrString = [[NSAttributedString alloc]
initWithString:note.title
attributes:attrs];

myTextLabel.attributedText = attrString;

关于ios - iOS 7 SDK 中 UILabel 的凸版效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18920858/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com