How to set the content size of NSScrollView?

Developer picture Developer · Mar 19, 2012 · Viewed 12.9k times · Source

I am new to Mac OSX Programming. I have created on iOS apps in which I can set The content size of UISCrollView by using contentSize property. But there is no such property I found for Mac Apps. How it can be done and how can I enable the scrolling in Mac App. I looked on to the other questions on Stackoverflow but I didn't find anything relevant. Thanks-

Answer

Sohaib picture Sohaib · May 10, 2012

NSScrollView has documentView attached to it. You can change the content size by updating the frame of documentView.

[scrollView.documentView setFrame: NSMakeRect(0,0,new_width, new_height) ];