Table of TextViews
Table of TextViews
- Subject: Table of TextViews
- From: Charles Jenkins <email@hidden>
- Date: Wed, 08 Oct 2014 21:59:26 -0400
I’m still struggling to create a single scrollview containing a stack of textviews.
I created an object called “Subdocument” which has two important readonly properties:
NSTextView* myView
CGFloat myHeight
myHeight returns myView's frame hight, but never less than 10. The Subdocument’s initializers take care of instantiating and connecting up all four text objects (TextView, TextContainer, LayoutManager, and TextStorage).
For now, my Document class has one important property which is read/write:
NSMutableArray* subdocumentStack;
The Document initializer creates and plugs in an array of 20 subdocuments as a test.
In my NIB, I add an NSArrayController and set it to manage the Subdocument class and bind it to File’s Owner’s subdocumentStack.
Then I add a view-based NSTableView and turn off unnecessary things like column headers, column selection, and column resizing.
If I run my application at this point, everything is fine, but the table is empty. NSLog statements confirm the subdocumentStack contains 20 objects with views and heights.
Now I try to bind the table. I select the Table View object and bind Table Content to the array controller’s arrangedObjects myView key path. Then I bind its Row Height to the array controller’s arrangedObjects myHeight key path.
The next time I run the program, no document ever appears. Initialization happens normally, but before the window opens, an error is logged: [__NSArrayI doubleValue]: unrecognized selector sent to instance <address>.
If I unbind the Row Height, the document window will appear, but the views are all copies of the default Text View Cell.
Now, IB liked all the model key paths I chose. subdocumentStack was in the suggestion list for the array controller; and myView and myHeight were in the suggestion lists for table bindings.
So here’s my first question:
What if anything am I doing wrong when I try to bind the row height? Adding that one thing causes the error and interrupts the NIB from loading.
—
Charles Jenkins
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden