0

I have a NSViewController that contains a NSScrollView, I would like to add the content of that NSScrollView as a NSView defined in the Storyboard but I can't do it in any way.

I do not want to create the content programmatically, I would prefer to define it on the storyboard because the content is static.

@IBOutlet weak var scrollView: NSScrollView!
scrollView.addSubview(//What to add here?)

This question is similar to this referred to iOS programming How to use UIScrollView in Storyboard.

Community
  • 1
  • 1
Matt
  • 773
  • 2
  • 15
  • 32
  • What is the problem? I just tried dragging a scroll View into a NSViewController, and then an NSView into the ScrollView, and it all seemed to work fine on the storyboard. – emrys57 Apr 08 '15 at 13:25
  • @emrys57 the problem is that in the NSScrollView you can't "prepare" the entire view because of the fixed dimensions of a window, I would "prepare" it outside on a bigger view controller that I would add in the NSScrollView. – Matt Apr 08 '15 at 14:37
  • @emrys57 same question but about iOS, it has not a similar solution for OS X programming http://stackoverflow.com/questions/12905568/how-do-i-use-uiscrollview-in-storyboard – Matt Apr 08 '15 at 14:41
  • Duplicate of http://stackoverflow.com/questions/27440433/how-to-embed-a-storyboard-view-controller-in-an-nsscrollview-os-x-10-10-to-mak see my answer there: http://stackoverflow.com/questions/27440433/how-to-embed-a-storyboard-view-controller-in-an-nsscrollview-os-x-10-10-to-mak/33745624#33745624 – Alejandro Nov 17 '15 at 23:37

2 Answers2

1

The answer is to use a xib file.

Matt
  • 773
  • 2
  • 15
  • 32
0

Usually when dealing with NSScrollViews, it always helps to use constraints (especially if your app is universal for different versions of iPhone/iPad). Have you tried working with them?

Nelson Matias
  • 453
  • 1
  • 4
  • 15