0

I am fairly new to apps and Objective-C as a whole. I was creating a slider that sends it's output to a label displaying the number. Here is the code:

- (IBAction)sliderChanged:(id)sender {
    UISlider *slider = (UISlider *)sender;
    self.sliderText.text = [NSString stringWithFormat:@"%f", slider.value];
}

And behold the error:

2014-01-10 17:17:29.037 tapbuttonipad[64226:70b] -[NSViewController sliderChanged]: unrecognized selector sent to instance 0x8a6f450
2014-01-10 17:17:29.061 tapbuttonipad[64226:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSViewController sliderChanged]: unrecognized selector sent to instance 0x8a6f450'

The slider is linked to that block of code. I am unsure as to what I am doing wrong.

Any help is greatly appreciated.

EDIT:

Someone who answered but then deleted their answer was actually correct, and now my app does not crash. However, the app still does not update the label that it was meant to. I changed it from setting the value to just setting @"test", but it still did not change.

ANOTHER EDIT:

Darn, I am stupid. I had my label variable as a text field instead of a label... gah! Anyway, this is completely fixed now. Thanks everyone!

Rob Alsod
  • 2,635
  • 3
  • 19
  • 18

2 Answers2

0

You should change the class of your view controller in your xib/storyboard to your NSViewController subclass:

  1. Select your view controller in object inspector
  2. In Identity inspector specify the name of your NSViewControllerSubclass in Custom Class field

enter image description here

Dmitry
  • 7,300
  • 6
  • 32
  • 55
0

Alright. I have fixed it. Firstly, it would throw an error as the slider was linked to the IBOutlet when it was without a colon, and I did not update it. After updating it worked fine.

Rob Alsod
  • 2,635
  • 3
  • 19
  • 18