带图像错误的UiPickerView

时间:2013-10-20 22:24:52

标签: iphone ios objective-c uipickerview

我有UiPickerView和colorCode.Plist - 其中包含图像名称。

我需要将这些图像添加到我的选择器视图中。


UipickerView

4分量

前3个组件中的10个图像

第4部分中的4张图片


用于电气用途的电阻器颜色代码等程序。 (抛出错误)

  {
@interface ResistorsColorView ()
{
NSArray *colorCode;    
}

@end

@implementation ResistorsColorView


- (void)viewDidLoad

{
[super viewDidLoad];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"colorCode" ofType:@"plist"];
colorCode = [[NSArray alloc] initWithContentsOfFile:filePath];
}

#  pragma mark - Datasource

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
 return colorCode.count;
}

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

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



-(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:            (NSInteger)component reusingView:(UIView *)view{


UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 60, 30)];

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 60, 30)];

imageView.image = colorCode[component][row];

imageView.image = [UIImage imageNamed:[record objectForKey:@"row1"]];




[v addSubview:imageView];

return v;
}

@end

1 个答案:

答案 0 :(得分:0)

原因:' - [__ NSCFString _isResizable]:无法识别的选择器发送到实例0x6e6e300' -