-2

(Newbie question) after mucking around with renaming folders/modules, etc. I find that events are no longer triggered. Looking in the story board inspector, all events look to be wired properly.

But no events are triggered in the view controller.

How can this be debugged? Could it be something wrong with the module names, relative paths or anything like that.

Code snippets:

class ViewController: UIViewController, STBackgroundTaskDelegate, MeshViewDelegate, UIGestureRecognizerDelegate, AVCaptureVideoDataOutputSampleBufferDelegate {

viewDidLoad:

override func viewDidLoad() {
    super.viewDidLoad()
    // ... more here...
}

Receiving method:

@IBAction func overlayTypeChangedWithSender(_ sender: AnyObject) {
    NSLog("Overlay type changed")
    showOverlay()
}
Dennis Thrysøe
  • 1,791
  • 4
  • 19
  • 31

2 Answers2

1

You may have forgotten to change the Custom Class in Storyboard or Xcode caches outdated data. Do the following:

  • Copy the NameOfViewController to the Custom Class field for your viewController in Storyboard.
  • Clean the project (Product -> Clean)
  • Clear Derived Data. Here is how.
  • Restart Xcode
  • Build & Run
Community
  • 1
  • 1
shallowThought
  • 19,212
  • 9
  • 65
  • 112
0

Have you tried connecting another control in one of your problem classes? If you can do that, have a look at the connections inspector for the new control, and earlier ones in the same view - they SHOULD be connected to the same class (of course), but if they are not, you just need to remove the old connection and reconnect

Russell
  • 5,436
  • 2
  • 19
  • 27
  • I tried with several controls, none of them work. I removed and re-added all connections, and it still doesn't work. – Dennis Thrysøe Jan 30 '17 at 07:58
  • 1
    So you definitely have the right connection between your class file and the View Controller - or you wouldn't be able to attach new outlets... What events are failing? Do you need delegates to be set up, or is it even failing for simple actions on buttons, for instance? – Russell Jan 30 '17 at 08:19
  • Yes, failing for buttons and UISegmentedControl. – Dennis Thrysøe Feb 01 '17 at 19:51
  • You need to show us the code - all the declarations at the top of the UIViewController file, `viewDidLoad` and the actions you have set up. – Russell Feb 01 '17 at 20:01
  • I added some code. Hope it helps. Thanks for trying :) – Dennis Thrysøe Feb 02 '17 at 20:24
  • What is `overlayTypeChangedWithSender`? Is it one of your custom methods? Where do you set this up as an action? What delegate is it related to? – Russell Feb 02 '17 at 20:32
  • Yes, this is a custom method. It is configured in the storyboard to receive the event (and it used to work, at least for some of the buttons; I am not 100% sure when it stopped working, but I assume it relates to changing around some names). – Dennis Thrysøe Feb 04 '17 at 10:35