我想构建一个按钮,每次按下时都会将图像旋转90°。我试图这样做,但它不起作用
(IBAction)Rotate:(id)sender {
staticPictureOriginalOrientation=UIImageOrientationLeft;
[self.imageView setInputRotation:staticPictureOriginalOrientation atIndex:0];
[staticPicture addTarget:filter];
[staticPicture processImage];
}
我得到的是这个
点击按钮+ 90°旋转图像和processImage
答案 0 :(得分:0)
我正在使用此代码做同样的事情:
selectedFilter = [[GPUImageTransformFilter alloc] init];
[(GPUImageTransformFilter *)selectedFilter setAffineTransform:CGAffineTransformMakeRotation((M_PI)*0.5)];
self.img = [selectedFilter imageByFilteringImage:self.img];
self.mainImage.image = self.img;
self.originalImage = self.img;