How to remove [[UIColor grayColor] CGColor]
stupid warning?
[self setValue:
[[UIColor grayColor] CGColor]
forKeyPath:[NSString stringWithFormat:@"_View_%@%d.layer.borderColor",
i>=10?@"":@"0", i]];
Incompatible pointer types sending 'CGColorRef' (aka 'struct CGColor *') to parameter of type 'id'
thanks.
cast CGColor to id type:
[self setValue:
(id)[[UIColor grayColor] CGColor]
forKeyPath:[NSString stringWithFormat:@"_View_%@%d.layer.borderColor",
i>=10?@"":@"0", i]];
This will perform same as above code.
[self setValue:
(id)[[UIColor grayColor] CGColor]
forKeyPath:[NSString stringWithFormat:@"_View_%02d.layer.borderColor", i]];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.