“...:”的方法定义未找到 [英] Method Definition for "...:" Not Found

查看:136
本文介绍了“...:”的方法定义未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序不断出现语义错误并且一直冻结/崩溃。所有内容似乎都很好地连接在一起并且启动没有问题。 TextFields运行正常,但是一旦我点击其他任何内容它就会失败并强行退出。有什么建议?

My app keeps coming up with a "Semantic Error" and keeps freezing/crashing.Everything seems to be stringed together fine and it launches without problem. TextFields work fine but as soon as I click anything else it fails and forces out. Any recommendations?

h。

@interface ViewController : UIViewController {
    IBOutlet UITextField *buy1;
    IBOutlet UITextField *sell1;
    IBOutlet UILabel *percentage1;
    IBOutlet UILabel *profit1;
    IBOutlet UITextField *royalty;
    IBOutlet UITextField *buy2;
    IBOutlet UILabel *sell2;
    IBOutlet UITextField *percentage2;
    IBOutlet UILabel *profit2;

}
@property (weak, nonatomic) IBOutlet UITextField *buytext1;
@property (weak, nonatomic) IBOutlet UITextField *selltext1;
@property (weak, nonatomic) IBOutlet UILabel *percentage1;
@property (weak, nonatomic) IBOutlet UILabel *profit1;
@property (weak, nonatomic) IBOutlet UITextField *royalty;
@property (weak, nonatomic) IBOutlet UITextField *buytext2;
@property (weak, nonatomic) IBOutlet UILabel *sell2;
@property (weak, nonatomic) IBOutlet UITextField *percentagetext2;
@property (weak, nonatomic) IBOutlet UILabel *profit2;

-(IBAction)Button;

- (IBAction)backgroundTouched:(id)sender;

- (IBAction)textfieldReturn:(id)sender;

@end

m。

@implementation ViewController
        //This is where I keep getting the Semantic Error "Incomplete Implementation"
@synthesize buytext1;
@synthesize selltext1;
@synthesize buytext2;
@synthesize percentagetext2;

- (IBAction)backgroundTouched:(id)sender {
    [buy1 resignFirstResponder];
    [sell1 resignFirstResponder];
    [buy2 resignFirstResponder];
    [percentage2 resignFirstResponder];

}

    - (IBAction)textFieldReturn:(id)sender {
        [buy1 resignFirstResponder];
        [sell1 resignFirstResponder];
        [buy2 resignFirstResponder];
        [percentage2 resignFirstResponder];

}



int VarBuy1 = 0;
int VarSell1 = 0;
int VarProfit1 =0;
int VarPercentage1 =0;
int VarRoyalty = 0;
int VarBuy2 = 0;
int VarSell2 = 0;
int VarProfit2 =0;
int VarPercentage2 =0;


-(IBAction)Button{
    VarBuy1 = ([buy1.text intValue]);
    VarSell1 = ([sell1.text intValue]);

    VarProfit1 = (VarSell1 - (VarSell1 * (VarRoyalty / 100)) - VarBuy1);
    VarPercentage1 = (VarProfit1 / VarSell1);
    VarSell2 = (VarBuy2 / ((100 - VarRoyalty) / 100 - VarPercentage2));
    VarProfit2 = (VarSell2 - (VarSell2 * VarRoyalty) - VarBuy2);

    profit1.text = [[NSNumber numberWithInt:VarProfit1] stringValue];
    percentage1.text = [[NSNumber numberWithInt:VarPercentage1] stringValue];
    sell2.text = [[NSNumber numberWithInt:VarSell2] stringValue];
    profit2.text = [[NSNumber numberWithInt:VarProfit2] stringValue];
}

@end


推荐答案

在.h

- (IBAction)textfieldReturn:(id)sender;

在.m

- (IBAction)textFieldReturn:(id)sender

小心字母大小写。字段和字段。

Be careful about letter cases. field and Field.

没有(id)发件人的IBAction听起来不太好。

And an IBAction without (id)sender doesn't sound good.

这篇关于“...:”的方法定义未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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