gpt4 book ai didi

iphone - UITextView 计算不起作用

转载 作者:行者123 更新时间:2023-12-03 19:12:00 25 4
gpt4 key购买 nike

考虑以下代码:

这是我的价格计算器 Controller 头文件。

#import <Foundation/Foundation.h>
#import "PriceCalculator.h"

@interface PriceCalculatorController : UITextField {

IBOutlet UITextField *mpgField;
IBOutlet UITextField *milesField;
IBOutlet UITextField *priceField;
IBOutlet UITextField *ridersField;
IBOutlet UITextField *splitField;

PriceCalculator *calculator;
}


-(IBAction)calculator:(id)sender;

@end

这是它的实现文件:

#import "PriceCalculatorController.h"

@implementation PriceCalculatorController


- (IBAction)calculator:(id)sender {

float split;

calculator = [[PriceCalculator alloc]init];


[calculator setMpg:[mpgField float]];
[calculator setRiders: [ridersField float]];
[calculator setMiles: [milesField float]];
[calculator setPrice: [priceField float]];


split = [calculator CalculateSplit];

[splitField setFloatValue:split];
}
@end

它给了我错误:

receiver type 'UITextField' for instance message does not
declare a method with selector 'float' [4]

发生什么事了?

最佳答案

关于iphone - UITextView 计算不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7078646/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com