0

Similar to this question (Get the representedObject values of NSCollectionViewItem NSButton click) that asks how to get the representedObject of an action invoked from an NSButton, how do I get the representedObject of an action invoked from an NSTextView in an NSCollectionViewItem? I have a method in the NSTextView's delegate that is called when the user presses "tab" in the NSTextView. However, I do not know how to figure out which view called the action, as there is no "representedObject" outlet for an NSTextView like there is in the cell of an NSButton.

Community
  • 1
  • 1
Zag
  • 819
  • 1
  • 8
  • 12

1 Answers1

0

well you can do this a bunch of different ways, you could ask the text view for its superview... which could be the item... depending on your layout. You could set up a dictionary of views and items, you could subclass the text view to have a represented object, or you could use bindings...

Grady Player
  • 14,399
  • 2
  • 48
  • 76
  • I've already tried using the superviews, but that doesn't work once the objects are rearranged – Zag Feb 10 '14 at 04:03
  • @user3247160 what happens when they are rearranged? sender should still be contextually linked to the model... – Grady Player Feb 10 '14 at 07:50