0

I have an NSMatrix, embedded within a scroll view (using IB). It works great, using the -sizeToCells method after changing the number of rows/columns. But I would like to move the initial matrix inside the scrollview. IB grays out the X and Y settings. Why, and how would it be possible to change the origin?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Carelinkz
  • 936
  • 8
  • 27

1 Answers1

2

IIRC, the NSScrollView or its NSClipView will always set the documentView's origin to (0,0). (Might be in -[NSScrollView tile]?)

Therefore, IB disables the origin settings because they will never be used.

If your app is working correctly, I wouldn't worry about what it looks like in IB.

Kurt Revis
  • 27,695
  • 5
  • 68
  • 74
  • Thanks, I will look into that. But what I need to do, is shift my matrix to the right and down, so I can place labels inside. I suppose that can be done if I manually design my `NSScrollView` and dump everything I need in there. (But the automatically working scroll bars are soooo handy....) Am I correct in assuming that the embedding can only result in a single control inside the scrollview? – Carelinkz Apr 08 '12 at 20:31
  • `NSScrollView` can contain only one `NSView` as its `documentView`, yes. However, you can put as many subviews in the documentView as you like. You don't need to subclass `NSScrollView` or `NSClipView`, just make a subclass of `NSView` to be the `documentView`. – Kurt Revis Apr 08 '12 at 21:06