Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the content size of NSScrollView?

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-

like image 793
Developer Avatar asked Mar 19 '12 11:03

Developer


People also ask

What is use of ScrollView content size method swift?

Overview. Scroll views allow you to display content in an area on the screen that is smaller than the size of the content. They allow the user to pan (scroll) and/or zoom the content. The UITableView and UICollectionView are a subclasses of UIScrollView , so many of the points below will apply to them as well.

What is content offset scroll view?

contentOffset is the point at which the origin of the content view is offset from the origin of the scroll view. In other words, it is where the user has currently scrolled within the scroll view. This obviously changes as the user scrolls.

What is content size Swift?

Swift version: 5.6. Paul Hudson @twostraws April 18th 2020. Most views have an intrinsic content size, which refers to the amount of space the view needs for its content to appear in an ideal state.

What is scroll view in Swift?

The scroll view displays its content within the scrollable content region. As the user performs platform-appropriate scroll gestures, the scroll view adjusts what portion of the underlying content is visible. ScrollView can scroll horizontally, vertically, or both, but does not provide zooming functionality.


1 Answers

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) ];

like image 118
Sohaib Avatar answered Oct 28 '22 07:10

Sohaib