Create Button to Rotate GPUImage
I want to build a button that every time you press rotates the image by 90 °. I tried to do so, but it does not work
(IBAction)Rotate:(id)sender {
staticPictureOriginalOrientation=UIImageOrientationLeft;
[self.imageView setInputRotation:staticPictureOriginalOrientation atIndex:0];
[staticPicture addTarget:filter];
[staticPicture processImage];
}
what I get is this
Tap Button +90° rotate image and processImage
Your code there only rotates it once. Also, you're using the wrong type of enumeration there. -setInputRotation: takes a GPUImageRotationMode enumeration, the possible values for which are kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizonal, kGPUImageRotateRightFlipVertical, and kGPUImageRotate180.
You need to have your rotation change in stages, based on what the previous rotation value was.
Thank you so much for your reply but I can not figure out how to use it Could you tell me how to do the button to rotate 90 degrees for each TAP.
As I said above, you need to have a conditional statement (most likely a switch) that changes the input orientation applied to the view based on what it was previously. You need to swap these out in consecutive 90 degree steps with each press of the button. I'll leave it to you to order these properly.