我有一个 UIPickerView 和一个数组,尽管我似乎无法将数组中的所有日期输入到 UIPicker 中。
我知道语法是这样的:
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return [treatments objectAtIndex:row];
}
治疗方法是数组名称,但是当我使用它时会出现以下错误:
-[Treatment isEqualToString:]: unrecognized
我搜索了我的整个项目,但找不到这句话:isEqualToString
治疗.h 文件:
#import <Foundation/Foundation.h>
@interface Treatment : NSObject {
NSString *treatmentid;
NSString *treatmentName;
NSString *treatmentPrice;
}
@property (nonatomic, strong) NSString *treatmentid;
@property (nonatomic, strong) NSString *treatmentName;
@property (nonatomic, strong) NSString *treatmentPrice;
@end
所有选择器代码:
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
return [treatments count];
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
return 1;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return [treatments objectAtIndex:row];
}
如果您需要更多代码,只需说
提前致谢