How to have multiple elements be able to be affected by view controller

122 views Asked by At

I have an extremely basic project with multiple view controllers. The first view has a scroll view with buttons. If you press a button on the scroll view, it goes to a different view controller. I need a scroll view on that view. The current tutorial I am using is the one by Jared Davidson (https://www.youtube.com/watch?v=5hIyn_UdFIc). He puts properties on the scroll view in the view controller.

import UIKit

class ViewController: UIViewController {


@IBOutlet weak var scrollView: UIScrollView!


override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    scrollView.contentSize.height = 1000
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}


}

The second scroll view will have slightly different properties, but Xcode won't let me control click drag into the view controller to make an @IBOutlet for the second scroll view.

Thank you in advance.

1

There are 1 answers

3
ranunez On

Are you sure you set the correct class in your view in Interface Builder to the correct view controller?

Within Interface Builder (your storyboard), select your second view controller, and on the right side pane, change the class name to the name of your second view controller class

enter image description here