Objective-c:UIColor * exception'NSInvalidArgumentException?

时间:2011-09-05 11:44:57

标签: iphone objective-c ios exception uicolor

我正在尝试将UIColor值存储在其中UIColor是类成员的对象中。

当我尝试检索它时会抛出错误

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayerArray set]: unrecognized selector sent to instance 0x5394860'

....第一次调用堆栈:

_product.ProductTextColor = [self selectColor];

- (UIColor *)selectColor
{
    return [UIColor colorWithRed:(0.0/255) green:(204.0/255) blue:(51.0/255) alpha:1.0f];
}

ProductDetails *prod = [productList objectAtIndex:indexPath.row];
lblProductname.textColor = prod.ProductTextColor;

在最后一行我试图获得价值,但它抛出错误。

@property (nonatomic, assign) UIColor *ProductTextColor;

是Product class的成员。

1 个答案:

答案 0 :(得分:2)

替换声明

@property (nonatomic, assign) UIColor *ProductTextColor;

@property (nonatomic, retain) UIColor *ProductTextColor;