文本属性Attributes

2023-10-07 03:18
文章标签 文本属性 attributes

本文主要是介绍文本属性Attributes,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文本属性Attributes

1.NSKernAttributeName: @10 调整字句 kerning 字句调整

2.NSFontAttributeName : [UIFont systemFontOfSize:_fontSize] 设置字体

3.NSForegroundColorAttributeName :[UIColor redColor] 设置文字颜色

4.NSParagraphStyleAttributeName : paragraph 设置段落样式

5.NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];

paragraph.alignment = NSTextAlignmentCenter;

6.NSBackgroundColorAttributeName: [UIColor blackColor] 设置背景颜色

7.NSStrokeColorAttributeName设置文字描边颜色,需要和NSStrokeWidthAttributeName设置描边宽度,这样就能使文字空心.

NSStrokeWidthAttributeName这个属性所对应的值是一个 NSNumber 对象(小数)。该值改变描边宽度(相对于字体size 的百分比)。默认为 0,即不改变。正数只改变描边宽度。负数同时改变文字的描边和填充宽度。例如,对于常见的空心字,这个值通常为3.0。

同时设置了空心的两个属性,并且NSStrokeWidthAttributeName属性设置为整数,文字前景色就无效果了

 

效果:

  

效果:

 

8. NSStrikethroughStyleAttributeName 添加删除线,strikethrough删除线

 

效果:

 

9. NSUnderlineStyleAttributeName 添加下划线

 

效果:

 

10. NSShadowAttributeName 设置阴影,单独设置不好使,必须和其他属性搭配才好使。

和这三个任一个都好使,NSVerticalGlyphFormAttributeName,NSObliquenessAttributeName,NSExpansionAttributeName

 

11.NSVerticalGlyphFormAttributeName

该属性所对应的值是一个 NSNumber 对象(整数)。0 表示横排文本。1 表示竖排文本。在 iOS 中,总是使用横排文本,0 以外的值都未定义。

 

效果:

 

12. NSObliquenessAttributeName设置字体倾斜。Skew 斜

 

效果:

 

13. NSExpansionAttributeName 设置文本扁平化

 

效果:

 

这篇关于文本属性Attributes的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/155703

相关文章

特征选择错误:The classifier does not expose coef_ or feature_importances_ attributes

在利用RFE进行特征筛选的时候出现问题,源代码如下: from sklearn.svm import SVRmodel_SVR = SVR(C=1.0, cache_size=200, coef0=0.0, degree=3, epsilon=0.1, gamma='auto',kernel='rbf', max_iter=-1, shrinking=True, tol=0.001, verb

2、TENSOR ATTRIBUTES

每个 torch.Tensor 都有一个 torch.dtype、torch.device 和 torch.layout。 torch.dtype CLASStorch.dtype torch.dtype 是表示 torch.Tensor 的数据类型的对象。 PyTorch 有十二种不同的数据类型: Data type dtype Legacy Constructors 32-bi

CSS文本属性与字体

一,文本属性  text-decoration text-transform text-indent text-align word/letter-spacing text-decoration text-decoration取值为: none:去除所有装饰underline:添加下划线overline:添加上划线line-through:添加中划线 text-t

Deep Identity-aware Transfer of Facial Attributes

网络分为两部分,第一部分为face transform network,得到生成图像,该网络还包括一个判别网络用于判别输入图像的真假,以及一个VGG-Face Netowork,用于判别输入图像的性别,即identity loss. 利用face transform network得到的生成图像比较模糊,因此将生成图像输入一个enhancement network,得到增强图像. 网络结构如下

Android Tools Attributes,让布局设计所见即所得

原创 2016-10-13 亦枫 技术鸟 技术鸟 技术鸟 微信号 NiaoTech 功能介绍 上谈【安卓】,下论【苹果】。以扯淡的态度,面对操蛋的技术,用幽默的语言,诠释开发的经典。 回复1024 随机给你一个惊喜 开发人员在设计Android Layout布局时,总会伴随着一些乱七八槽的困扰。比如,为了更加逼真的真实数据预览效果,我们在开发时会将T

js深入理解对象的 属性(properties)的特殊 特性(attributes)

对象    js对象 // 构造一个对象let obj = {};let obj = new Object();         我们知道js中一切皆对象,对象是一个键值对集合(key: value),一个键(key)对应一个值(value),而每个键都是这个对象的属性,我们可以通过对象的属性来获取对应的值,但是对于对象的属性来说,他还有一些“隐式”的特性。 属性标志 对象属性(pr

In Gradle projects, always use http://schemas.android.com/apk/res-auto for custom attributes

Eclipse中提示: In Gradle projects, always use http://schemas.android.com/apk/res-auto for custom attributes 原: xmlns:listViewAttr="http://schemas.android.com/apk/res/com.xx.xxxx" 修改成: xmlns:

attributes.nodeName和attributes.nodeValue有什么区别(代码举例说明)

在DOM(Document Object Model)中,attributes 是一个 NamedNodeMap 对象,它包含了元素的所有属性。然而,attributes 集合中的每个属性本身是一个 Attr 对象,而不是简单的字符串或值。Attr 对象有几个属性,其中 nodeName 和 nodeValue 是两个常用的。 attributes.nodeName nodeName 属性返回

FireBreath -- Summary--方法 属性 Attributes 事件和js的交互等

【方法】 JSAPI 对javascript暴露了四种基本类型的接口(Methods, Properties, Attributes, and Events),每一种接口都必须在JSAPI对象的构造函数中注册(Attributes和Events除外)。 Attributes可以在任何一个除了析构函数的函数中注册(registerAttribute(const std::string& s

vue3属性透传(透传 Attributes),支持多个根节点,且可以在JavaScript 中访问透传 Attributes

支持多个根节点,且可以在JavaScript 中访问透传 Attributes Index.vue: <script setup>import { ref, onMounted } from 'vue'import Child from './Child.vue'import './index.css'const handleClick = () => {console.log(1)}