gpt4 book ai didi

iphone - objective-c : UIColor * exception 'NSInvalidArgumentException?

转载 作者:行者123 更新时间:2023-11-28 23:13:46 25 4
gpt4 key购买 nike

我试图将 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 类的成员。

最佳答案

替换声明

@property (nonatomic, assign) UIColor *ProductTextColor;

@property (nonatomic, retain) UIColor *ProductTextColor;

关于iphone - objective-c : UIColor * exception 'NSInvalidArgumentException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7307592/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com