drawRect - Draw Star
问题 I am drawing annotations on a view. The approach i am using to draw star is below. -(void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 2.0); CGFloat xCenter = rect.size.width / 2; CGFloat yCenter = rect.size.height / 2; float width; if(rect.size.width > rect.size.height) { width = rect.size.height; } else { width = rect.size.width; } double r = width / 2.0; float flip = -1.0; double theta = 2.0 * M_PI * (2.0 / 5.0); // 144