尝试清除计算器导致崩溃 [英] Crash from attempting to clear a calcuator

查看:58
本文介绍了尝试清除计算器导致崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我正在尝试为波兰语计算器创建一个清除按钮。.代码在执行清除按钮时给我这个错误

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

无法识别的选择器已发送到实例0x6a6e1e0 '

unrecognized selector sent to instance 0x6a6e1e0'

界面生成器中有一个链接到clearBtn的按钮

there is a button in the interface builder linked to clearBtn

此代码在CalculatorViewController.m中
的显示链接到UILabel
和..
此处的代码

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?

了解关于Objective-C选择器的信息此处

Read about Objective-C selectors here.

通常来说,Interface Builder非常有用umm,建立界面的工具。但是您必须注意连接,并确保在更改代码或布局后所有内容仍保持链接。

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.

这篇关于尝试清除计算器导致崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆