简体   繁体   English

Objective-c:UIColor * exception'NSInvalidArgumentException?

[英]Objective-c : UIColor * exception 'NSInvalidArgumentException?

I am trying to store UIColor value in its object where UIColor is member of class. 我试图将UIColor值存储在其中UIColor是类成员的对象中。

When I try retrieve the value it throws error 当我尝试检索值时,它会抛出错误

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

.... Call stack at first throw: ....第一次投掷堆栈:

_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;

At last line I am trying to get value but its throwing the error. 在最后一行,我试图获得价值,但它抛出错误。 where 哪里

@property (nonatomic, assign) UIColor *ProductTextColor;

is member of Product class. 是Product class的成员。

Replace declaration 替换声明

@property (nonatomic, assign) UIColor *ProductTextColor;

with

@property (nonatomic, retain) UIColor *ProductTextColor;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM