0

链接到代码(这里的问题已解决):“...:”的方法定义未找到

链接到当前图像/问题:http: //imgur.com/xVoyp

该应用程序启动正常,文本字段和键盘工作正常。但是,如果我尝试在页面之间切换或点击计算按钮,应用程序强制关闭并失败。有什么建议、提示或线索吗?在这一点上,我完全迷失了。(固定的)

我现在已经把其他的事情都处理好了。但是,每当我尝试计算时,它什么也没做。第一个视图中的 PAR 和 PP 下的黑色文本标签以及第二个视图中的 Sell 和 PAR 是假设方程答案的输出。由于某种原因,它不计算。建议?

图片http://imgur.com/q2lty

。H

#import <UIKit/UIKit.h>

@interface keyboardclose : 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 *profit1;
@property (weak, nonatomic) IBOutlet UILabel *percentage1;
@property (weak, nonatomic) IBOutlet UITextField *royalty;
@property (weak, nonatomic) IBOutlet UITextField *buytext2;
@property (weak, nonatomic) IBOutlet UILabel *sell2;
@property (weak, nonatomic) IBOutlet UILabel *profit2;
@property (weak, nonatomic) IBOutlet UITextField *percentagetext2;


-(IBAction)answerQuestion1:(id) sender;
-(IBAction)answerQuestion2:(id) sender;

- (IBAction)backgroundTouched:(id)sender;
- (IBAction)textFieldReturn:(id)sender;

@end

.m

#import "keyboardclose.h"


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


@implementation keyboardclose
@synthesize buytext1;
@synthesize selltext1;
@synthesize buytext2;
@synthesize percentagetext2;

-(IBAction)answerQuestion1:(id) sender {
    VarBuy1 = ([buy1.text floatValue]);
    VarSell1 = ([sell1.text floatValue]);
    VarRoyalty =([royalty.text floatValue]);
    VarProfit1 =([profit1.text floatValue]);
    VarPercentage1 =([percentage1.text floatValue]);

    VarProfit1 = (VarSell1 - (VarSell1 * (VarRoyalty / 100)) - VarBuy1);
    VarPercentage1 = (VarProfit1 / VarSell1);

    profit1.text = [[NSNumber numberWithFloat:VarProfit1] stringValue];
    percentage1.text = [[NSNumber numberWithFloat:VarPercentage1] stringValue];

}

-(IBAction)answerQuestion2:(id) sender {
    VarRoyalty =([royalty.text floatValue]);
    VarBuy2 =([buy2.text floatValue]);
    VarSell2 = ([sell2.text floatValue]);
    VarProfit2 =([profit1.text floatValue]);
    VarPercentage2 =([percentage1.text floatValue]);

    VarSell2 = (VarBuy2 / ((100 - (VarRoyalty / 100)) / 100 - VarPercentage2));
    VarProfit2 = (VarSell2 - (VarSell2 * (VarRoyalty / 100)) - VarBuy2);

    sell2.text = [[NSNumber numberWithFloat:VarSell2] stringValue];
    profit2.text = [[NSNumber numberWithFloat:VarProfit2] stringValue];

}


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

}

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

}

@end
4

0 回答 0