How to add tab stops to a paragraph style?


(Jonas Whale) #1

What’s wrong in this:

set paraStyle to current application's NSParagraphStyle's defaultParagraphStyle()'s mutableCopy()
paraStyle's setTabStops:{"20L", "250L", "330L"}

I’m getting this error when writing data to disk:

-[NSTaggedPointerString alignment]: unrecognized selector sent to instance 0x4c303235

I guess this is not the right method to set tab stops…


(Shane Stanley) #2

You need to create each NSTextTab using initWithTextAlignment:location:options:. You can pass missing value for options unless you want tabs aligned to other than tabs.


(Jonas Whale) #3

Thanks Shane. Works perfectly.
:wink: