cocoa - Changes to NSTextView not reaching screen -


i have nstextview backed text system put myself, along lines of "assembling text system hand" section in text system overview in cocoa documentation. displays contents of nstextstorage on screen.

but when type it, nothing seems happen—the text on screen doesn't change. if select text, shape of selection suggests text has changed. if copy , paste text textedit, can see edits. , if type enough, can throw exception:

nsrunstorage, _nsblocknumberforindex(): index (5897) beyond array bounds (5881) 

golly, looks kind of thing spend better part of day debugging. what's going on here?

make sure connected nstextstorage nslayoutmanager this:

[textstorage addlayoutmanager:layoutmanager]; 

instead of this:

[layoutmanager settextstorage:textstorage];   //bad 

the documentation on -[nslayoutmanager settextstorage:] says should never called directly, overridden. apparently reason. saved hours , hours of fruitless work!


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -