views:

87

answers:

1

Hi I'm developing a simple writing program using UITextView to study Cocoa programming. In UITextView, each line has different number of characters. I tried to change fonts of UITextView, but the width of each character seems to vary. For example, l and L has different width.

Is there anyway to keep the same number of characters in each line of UITextView like emacs or just like this editing box of stackoverflow?

Thank you so much.

+5  A: 

easiest way is to use a monospaced font like Courier New

cobbal
+1, provided you handwave the distinction between "characters"/glyphs/code points, and let's not get into control characters (a tab probably shouldn't be the same width as a space!)
tc.
@tc. Yep, although it is possible to have make each glyph the same size too using CTRunDelegate and CoreText (not recommended)
cobbal
Thank you so much!
kyu