Bavan
Bavan

Reputation: 1040

How to use NSScrollView in XCode 7+ Storyboards?

I have never used NSScrollView, but looking at the tutorials, I thought It should be easy to figure out.

However, It turns out to be not intuitive at all. I pulled a ScrollView. It did not have any scrollers, though I have then enabled. No place to set ContentArea or of some sort. And. it has a clipview inside it and that clip view has another view inside. You can only add a view inside that third View.

enter image description here

So I thought of adding an Image view inside and it doesn't work at all. When I run, it doesn't show up. Nothing.

enter image description here

What am I doing wrong?

Here is the DropBox Link to project

Upvotes: 1

Views: 830

Answers (1)

Eugene Mankovski
Eugene Mankovski

Reputation: 1180

You need 2 steps.

Fist you should position you view towards left top corner of clip view. Add 2 constraints as shown on the picture:

enter image description here

Then make sure you picture expands to parent view but set priority to 750 so it would not expand entire window:

enter image description here

Then it will look correct:

enter image description here

Here is your fixed project:

https://github.com/emankovski/NSScrollViewExperiment

PS: You also forgot to drag your picture to the assets catalog. I did that in the fixed project.

Upvotes: 5

Related Questions