NSString.sizeWithAttributes 支持的属性键列表? [英] List of supported attribute keys for NSString.sizeWithAttributes?

查看:43
本文介绍了NSString.sizeWithAttributes 支持的属性键列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 7 使用 NSString::sizeWithAttributes 来计算给定 NSDictionary 属性的 NSString 的边界框的大小.但是,我找不到列出可用于该 NSDictionary 的所有枚举键的资源.

iOS 7 uses NSString::sizeWithAttributes to calculate the size of the bounding box of an NSString given an NSDictionary of attributes. However, I can't find a resource that lists all the enumerated keys available for use in that NSDictionary.

NSString UIKit Additions Reference

这些是可以应用于 NSAttributedString 对象的相同属性

These are the same attributes that can be applied to an NSAttributedString object

但没有列出它们,它们也没有列在 NSAttributedString 文档.

but doesn't list them, and they're not listed in the NSAttributedString documentation either.

另外:在可用的属性键中,哪些是调整多行标签大小的最基本要素?看起来字体大小和换行模式是最重要的,但是没有可用选项的列表就很难说...

Also: of the available attribute keys, which are the most fundamental to sizing a multiline label? It seems that font size and line break mode are the most important, but without a list of the available options it's hard to say...

推荐答案

我搜索了 20 分钟,然后在 SO 上发布后立即 找到答案.叹气.

I search for 20 minutes and then find the answer immediately after posting on SO. Sigh.

为了将来参考,可用属性列在NSAttributedString - Foundation Reference,在字符属性部分.

For future reference, the available attributes are listed toward the bottom of the NSAttributedString - Foundation Reference, in the Character Attributes section.

这篇关于NSString.sizeWithAttributes 支持的属性键列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆