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-
Asked
Active
Viewed 1.4k times
15
-
Did you find anything on this? – Yogi Apr 19 '12 at 09:46
1 Answers
31
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) ];
-
1CGRectMake is incompatible with NSRect and does not compile. – Henrik Erlandsson Apr 11 '13 at 13:29
-
4
-
6
-
-
5NOTE: it's very important that you update the *frame* of the documentView, and not its bounds. I just wasted a couple of days because I was changing the bounds, which produces a completely different result than the one intended. – Joe Strout Jan 26 '15 at 17:41
-
2Does not seem to work in Swift as documentView is a constant and its variables can therefore not be assigned to. – Ash Feb 04 '16 at 10:49