i have the following code in a layer delegate. it simply draws a blue circle. it works perfectly on 32 bit iOS devices, but draws nothing on 64 bit iOS devices. why?

-(void) drawLayer:(CALayer *)layer inContext:(CGContextRef)context
{
    CGContextAddArc(context, 100., 100., 10., -M_PI, M_PI, YES);
    CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
    CGContextFillPath(context);
}
有帮助吗?

解决方案

figured it out. casting M_PI to a float solved the problem. this must have something to do with the fact that CGContextAddArc takes CGFloat arguments, and CGFloat is defined differently on 32 bit versus 64 bit platforms. on 32 bit, it's a float, on 64 bit it's a double.

CGContextAddArc(context, 100., 100., 10., -(float)M_PI, (float)M_PI, YES);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top