UIPicker视图和UITable视图

| 我在UIPickerview和UITableview中都遇到常见错误,即
Terminating app due to uncaught exception \'NSUnknownKeyException\', reason: \'[<UIViewController 0x4d32080> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key CurrencyPicker.\'
Terminating app due to uncaught exception \'NSUnknownKeyException\', reason: \'[<UIViewController 0x4b2c070> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key tableView.\'
请帮我为什么。 我认为这是由于数据源以及tableview和picker视图与文件所有者的委托连接。但我做对了所有事情。 请帮我。 谢谢。     
已邀请:
        我认为这篇文章可以为您提供帮助     
        @Aman:这是代码: @ Aman:在setting.h中
@interface Setting : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource>{
    UIButton *button;

    NSMutableArray *CurrencyArray;
    IBOutlet UIPickerView *CurrencyPicker;
}
在setting.m中
- (void)viewDidLoad {
    [super viewDidLoad];

    CurrencyArray = [[NSMutableArray alloc] init];
    [CurrencyArray addObject:@\" Rs \"];
    [CurrencyArray addObject:@\" R$ \"];
    [CurrencyArray addObject:@\" $ \"];
    [CurrencyArray addObject:@\" ƒ \"];
    [CurrencyArray addObject:@\" ман \"];

    button=(UIButton *)[self.view viewWithTag:1];

    [CurrencyPicker selectRow:1 inComponent:0 animated:NO];
    [button setTitle:[CurrencyArray objectAtIndex:[CurrencyPicker selectedRowInComponent:0]] forState:UIControlStateNormal];
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;
{
    return 1;
}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
    [button setTitle:[CurrencyArray objectAtIndex:row] forState:UIControlStateNormal];
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;
{
    return [CurrencyArray count];
}

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;
{
    return [CurrencyArray objectAtIndex:row];
}
    

要回复问题请先登录注册