English 中文(简体)
文本编辑最佳做法(单位等)
原标题:Text editing best practices (with tags, etc.)

我想建立一个案文领域,有某些案文,即用斜体字。 想像MS的话,有些是粗体的,有些是头等。 文本风格的标签对使用者来说并不明显,他只是用黑体看到案文。

我如何保存这些标签? 我指的是,在我回过了最后勇敢的标签的时候,例如,我如何维护这一点,防止案文的其余部分现在大胆到底?

我猜测,这是经验规划者的一个基本问题。 是否有任何算法或最佳做法? 这个问题肯定在任何要点之前得到解决。

(如果这是任何关切的话,我为PeitOS而研拟,案文领域将是UITextView,但我的问题是我更一般的猜测。)

提前感谢!

问题回答

案文中不把风格视为公开/公开的标签,而是从NSRanges的角度来考虑,并相应加以调整。

至3.2岁,可使用NSAttributesString。 即便是你自己开张,这还是很好的参考。

属性适用于一系列特性。 添加或删除特性时,对幅度加以相应调整。

定型格式如超文本或区域工作组。 在编辑过程中,你需要复杂的数据结构,如OMM或NSAttributedString。





相关问题
Which non-bold UTF-8 iPhone SDK font can I use here?

Problem: I create a UILabel with this font: label.font = [UIFont systemFontOfSize:15.0f]; Now this system font is bold, but I want to display pretty small text, and the text may also contain very ...

Limiting file upload type

Simple question. Is there a way to only allow txt files upon uploading? I ve looked around and all I find is text/php, which allows PHP. $uploaded_type=="text/php

Extract everything from PDF [closed]

Looking for solution to extract content from a PDF file (using console tool or a library). It will be used on server to produce on-line e-books from uploaded PDF files. Need to extract following ...

Flash & external form fields

Does anybody know if this is possible? I am trying to create a flash movie that will show / preview what I am typing into a field in a normal HTML form. The call to update the flash movie would most ...

Avoiding escape sequence processing in ActionScript?

I need to mimic C# functionality of the @ symbol when it precedes a string. @"C:AFilePath" for example What is the best way to do this? Also there are some sites that will escape larger ...

iPhone: Draw rotated text?

I want to draw some text in a view, rotated 90°. I m pretty new to iPhone development, and poking around the web reveals a number of different solutions. I ve tried a few and usually end up with my ...

Numbering in jQuery

How could I change the text below so that the text within it has a number appended to it. <div class="right">This is some text</div> <div class="right">This is some text</div>...

热门标签