0

Why am I getting a breakpoint 2.5 on my outlet named scrollPages? I'm using it to make let the user scroll up and down but for some reason I'm getting breakpoint 2.5.

I didn't get the breakpoint before when I tried the app, then I added a feature that didn't work then I it and now when I removed the feature I still get it.

Here is my code and the outlet that gives me the breakpoint has a --> next to it. Thanks!

//  ViewController.swift


import UIKit

class ViewController: UIViewController, UIApplicationDelegate {


--> @IBOutlet weak var scrollPages: UIScrollView!



override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.


    let V1 : View1 = View1(nibName: "View1", bundle: nil)
    let V2 : View1 = View1(nibName: "View2", bundle: nil)

    self.addChildViewController(V1)
    self.scrollPages.addSubview(V1.view)
    V1.didMove(toParentViewController: self)

    self.addChildViewController(V2)
    self.scrollPages.addSubview(V2.view)
    V1.didMove(toParentViewController: self)


    var V2Frame : CGRect = V2.view.frame
    V2Frame.origin.y = self.view.frame.height
    V2.view.frame = V2Frame

    self.scrollPages.contentSize = CGSize(width: self.view.frame.width,
                                          height: self.view.frame.height * 2)


}

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


}
Philip J
  • 66
  • 6
  • 2
    You don't get a *breakpoint* you get a crash (runtime error). Please read https://stackoverflow.com/questions/32170456/what-does-fatal-error-unexpectedly-found-nil-while-unwrapping-an-optional-valu – vadian Jul 24 '17 at 04:47
  • A common reason for crashes on the IBOutlet declaration line are to do with issues with the connection Storyboard/Interface Builder. If you believe that it is all correct sometimes a clean or breaking and recreating the outlet connection clears things up. Without any more information from the crash it is hard to say... – Nathan Dries Jul 24 '17 at 05:05
  • Just another observation, on the class declaration did you mean register this class to conform to UIScrollViewDelegate instead of UIApplicationDelegate? – Nathan Dries Jul 24 '17 at 05:06
  • Perhaps you (inadvertently) *set* a breakpoint? Compare https://stackoverflow.com/a/32038314/1187415. – Martin R Jul 24 '17 at 05:25
  • What is a breakpoint 2.5? – HAS Jul 24 '17 at 06:27

0 Answers0