我有几个IBOutlet,并与IBOutletCollection一起使用它们:
@interface IBOutletCollectionViewController : UIViewController {
IBOutletCollection (UILabel) NSArray *multipleLabels;
}
@property (nonatomic , retain) IBOutletCollection (UILabel) NSArray *multipleLabels;
@end但是,当我想要使用UILable属性时,编译器会给出以下错误:
请求在非结构或联盟中加入“textColor”
我想是因为NSArray!有什么解决办法吗?
发布于 2010-12-27 01:01:33
可以使用键值编码对数组中的每个label实例设置属性:
[multipleLabels setValue:[UIColor redColor] forKey:@"textColor"];只要在属性声明中使用"IBOutletCollection(UILabel)“,就可以在iVar声明中省略它。
另一个选项是在makeObjectsPerformSelector实例上调用“NSArray:”:
[multipleLabels makeObjectsPerformSelector:@selector(setTextColor:) withObject:[UIColor redColor]];https://stackoverflow.com/questions/4488170
复制相似问题