1
double angle = -15;
UIImage *image = [UIImage imageNamed:@"test.jpg"];
CGSize s = {image.size.width, image.size.height};
UIGraphicsBeginImageContext(s);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(ctx, 0,image.size.height);
CGContextScaleCTM(ctx, 1.0, -1.0);
CGContextRotateCTM(ctx, 2*M_PI*angle/360);
CGContextDrawImage(ctx,CGRectMake(0,0,image.size.width, image.size.height),image.CGImage);
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
嗨,我不会在图像中心点旋转UIImage。我可以用这个代码旋转UIImage,但不能在中心点。如何在图像中心旋转UIImage
请帮帮我。