ios - passing argument 1 of 'setBackgroundColor:' from incompatible pointer type -
- (void)drawrect:(cgrect)rect { // drawing code. // backgroundcolor calayer *mylayer = [self layer]; [mylayer setbackgroundcolor:[uicolor colorwithred:0 green:0 blue:0 alpha:0.5].cgcolor]; ... }
when want setbackgroundcolor layer, warning occurred. code runs ok.
===========================================================
the best answer : #import <quartzcore/quartzcore.h>
if don't include quartz in module compiler not know cgcolor type , issues warning.
put #import <quartzcore/quartzcore.h>
in header , should remove warning.
hope helps,
dave
Comments
Post a Comment