Hey I'm trying to make a clear button for my polish calculator.. code give me this error when executing the clear button

unrecognized selector sent to instance 0x6a6e1e0'

there is a button in the interface builder linked to clearBtn

this code is in the CalculatorViewController.m display is linked to the UILabel and.. heres the code

- (IBAction)clearBtn
{
if (self.userIsInTheMiddleOfEnteringANumber) {
[[self display] setText:@"0"];
[self setUserIsInTheMiddleOfEnteringANumber:NO];
}    

}

- (IBAction)clearAllBtn //this button works fine.. 
{
[[self brain] clearAll];   // the brain class has a method to set the array to nill
[[self display] setText:@"0"];
[self setUserIsInTheMiddleOfEnteringANumber:NO];
}
有帮助吗?

解决方案

Thanks for posting the code. Generally, unrecognized selector errors are not tough, but we need to know which line of code is triggering it, which will help us understand which object is receiving the message, and what the selector is. Can you post a dump of the error messages?

Read about Objective-C selectors here.

Generally speaking, Interface Builder is a great tool for... umm, building interfaces. But you do have to be careful about connections and making sure everything is still linked up after making changes to your code or layout.

其他提示

kind of hard to know without seeing the rest of your code, but I'd assuming it's because you don't have a method named setUserIsInTheMiddleOfEnteringANumber. Maybe double check the spelling and parameter list?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top