我正在使用陀螺仪来处理旋转。对于我旋转 iPad 的每一度,我应该在屏幕上重新绘制图像以更改蒙版的高度。
但是重绘会停止陀螺仪。
这种情况我能做些什么?
添加了编辑代码
- (UIImage *)reflectedImage:(UIImageView *)fromImage withHeight:(NSUInteger)height
{
CGImageRef gradientMaskImage = CreateGradientImage(1, height);
CGImageRef masked = CGImageCreateWithMask([fromImage.image CGImage], gradientMaskImage);
CGImageRelease(gradientMaskImage);
UIImage *theImage = [UIImage imageWithCGImage:masked];
return theImage;
}
陀螺仪会给我一个值,我计算图像的高度。之后我调用这个函数来重绘蒙版和图像。因此,如果我滚动设备,图像会变暗或变暗。