Iphone 在上下文中旋转一行?
我在draw rect中画了两条线,但我想以一个角度旋转第一条线Iphone 在上下文中旋转一行?,iphone,ipad,iphone-sdk-3.0,cgcontext,Iphone,Ipad,Iphone Sdk 3.0,Cgcontext,我在draw rect中画了两条线,但我想以一个角度旋转第一条线 CGContextBeginPath(context); CGContextSetLineWidth(context, 10.0); CGContextSetStrokeColorWithColor(context, [UIColor blackColor].CGColor); CGContextMoveToPoint(context, 65, 40); CGContextAddLineTo
CGContextBeginPath(context);
CGContextSetLineWidth(context, 10.0);
CGContextSetStrokeColorWithColor(context, [UIColor blackColor].CGColor);
CGContextMoveToPoint(context, 65, 40);
CGContextAddLineToPoint(context,165, 40);
CGContextStrokePath(context);
CGContextClosePath(context);
CGContextBeginPath(context);
CGContextSetLineWidth(context, 10.0);
CGContextSetStrokeColorWithColor(context,[UIColor blackColor].CGColor);
CGContextMoveToPoint(context, 85, 80);
CGContextAddLineToPoint(context, 185, 80);
CGContextStrokePath(context);
CGContextClosePath(context);
您应该使用CGAffineTransformMakeRotation
CGAffineTransform rotation = CGAffineTransformMakeRotation(theAngle);
CGContextConcatCTM(context, rotation);
祝你好运