问题标签 [nsattributedstring]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ios - NSAttributedString 添加文本对齐
如何将文本对齐属性添加到 NSAttributedString 以使文本居中?
编辑:我做错了什么吗?它似乎没有改变对齐方式。
objective-c - NSTextView enclosing scroll view jumps on spacebar
I have an odd behavior with my app and I don't know where it comes from. I have implemented a NSScanner for a text view content that works very well. The scanner works in conjunction with the text storage to set attributes on the text storage string via text view delegate methods. However, each time I enter a space, the enclosing scroll view scrolls back to the top of the text view. Can anyone give me a hint where this comes from ?
iphone - 在 IOS 中读取 RTFD 数据
我在 IOS 的 NSData 对象中有需要读取的 RTFD 数据。在 MacOSX 中我只是用 NSAttributedString 来读取它们,但现在我知道它们在 IOS 中不受支持。
有什么方法可以在IOS中只读取RTFD数据的文本吗?
core-text - 核心文本。如何计算属性字符串的边界框?
在 CoreText 中,很容易问:“对于给定的矩形,这个属性字符串可以容纳多少?”。
将返回字符串中下一次文本应该开始的位置。
我的问题是:“给定一个属性字符串和一个宽度,我需要什么矩形高度才能完全绑定属性字符串?”。
CoreText 框架是否提供了执行此操作的工具?
谢谢,
道格
iphone - 在 iOS 中取消归档 NSAttributedString
我尝试在 Mac OSX 10.7 中存档 NSAttributedString,然后尝试在 iOS 4 中取消存档。我收到错误消息:
无法解码类的对象(NSParagraphStyle)
我看到 iOS 中没有 NSParagraphStyle 。所以我的问题是,有解决方法还是不可能?
cocoa - Retrieve image attachments locations on an NSAttributedString
I have an attributedString with image attachments on it, and I need to insert text to it without removing the images. The first thing that I'm doing is detecting at what indexes the images are currently attached.
Below is the code that I'm using, but it is not working all of the time, maybe there is a better way?
ios - 我可以从在 OS X 上创建的存档中检索 iOS 应用程序中的 NSAttributedString 吗?
我有一个使用 NSKeyedArchiver 存储其数据的 Mac 程序。我在 iOS 应用程序中使用相同的代码来尝试从文件中读取数据,但是在尝试解码 NSAttributedString 的实例时它会崩溃。NSAttributedString 的 iOS 和 OS X 版本是否兼容,即这是 iOS 中的错误吗?
如果没有,除了修改 Mac 应用程序,我还能做些什么吗?出于兼容性原因,我宁愿不必这样做。
iphone - iOS:让 NSAttributedString-Additions-for-HTML 工作?
我正在尝试使 NSAttributedString-Additions-for-HTML 工作,但该项目从未为我构建,存在错误。此外,我找不到任何文档来说明需要导入哪些文件以及如何将其与 HTML 一起使用。
有什么帮助吗?
objective-c - 如果标签包含带有部分字符串的 NSAttributed 字符串,如何获得准确的标签高度
我目前正在使用以下方法来获取标签所需的高度
这在大多数情况下都有效,但是,有些字符串由粗体和非粗体文本混合而成,这可能会影响极端情况下所需的确切高度。
例如
有什么方法可以得到含有这种混合物的标签的准确高度吗?
cocoa - NSAttributedString / NSTextTab 对齐问题
目标:
我正在尝试使用 NSAttributedStrings(结合 NSTextTabs)来创建以下布局:
尝试的解决方案:
我正在尝试的代码是:
NSMutableAttributeString在哪里attrString
,当前设置为“标题”。
但是,使用此代码(我假设会产生所需的输出)会产生以下结果:
更多的信息:
当我删除对 NSTextTabs 的引用时,如下所示:
我得到了不均匀标签的预期输出。
底线:
为什么 NSAttributedString 似乎忽略了 NSParagraphStyle/NSTextTabs?
我能做些什么来解决这个问题?