Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 图像旋转,覆盖按钮_Objective C - Fatal编程技术网

Objective c 图像旋转,覆盖按钮

Objective c 图像旋转,覆盖按钮,objective-c,Objective C,我想绕x轴从左向右旋转图像。问题是,当您旋转图像时,图像会覆盖位于顶部的按钮 运行动画 +(无效)向右旋转到左视图:(UIView*)翻转视图和持续时间:(NSTimeInterval)持续时间{ //在声明新动画之前删除现有动画 [flipView.layer RemoveAllianimations]; //确保视图可见 flipView.hidden=否; //显示1/2动画 //flipView.layer.DoubleSide=否; //禁用视图,使其在设置动画时不会执行任何操作

我想绕x轴从左向右旋转图像。问题是,当您旋转图像时,图像会覆盖位于顶部的按钮

运行动画
+(无效)向右旋转到左视图:(UIView*)翻转视图和持续时间:(NSTimeInterval)持续时间{

//在声明新动画之前删除现有动画
[flipView.layer RemoveAllianimations];
//确保视图可见
flipView.hidden=否;
//显示1/2动画
//flipView.layer.DoubleSide=否;
//禁用视图,使其在设置动画时不会执行任何操作
flipView.userInteractionEnabled=否;
//将CALayer锚点设置为左侧边缘,然后
//转换按钮以说明新的
//anchorPoint。如果要重复使用动画
//对于此按钮,我们只执行翻译和
//锚定点设置一次。
如果(flipView.layer.anchorPoint.x!=0.0f){
flipView.layer.anchorPoint=CGPointMake(0.0f,0.5f);
flipView.center=CGPointMake(flipView.center.x-flipView.bounds.size.width/2.0f,flipView.center.y);
}    
//创建动画以保持翻页
CABasicAnimation*transformAnimation=[CABasicAnimation animationWithKeyPath:@“transform”];
transformAnimation.removedOnCompletion=否;
transformAnimation.duration=持续时间;
transformAnimation.timingFunction=[CamediaTimingFunctionWithName:kCAMediaTimingFunctionEaseInEaseOut];
//从当前状态启动动画
transformAnimation.fromValue=[NSValue ValueWithCatTransformM3d:CatTransformM3DidEntity];
//这是沿y轴M_PI旋转180度的基本旋转
CATTransferM3D endTransform=CATTransferM3D旋转(弧度(180.0)、0.0f、-1.0f、0.0f);
transformAnimation.toValue=[NSValue ValueWithCatTransformM3D:endTransform];
//创建动画组以保持旋转
CAAnimationGroup*组=[CAAnimationGroup动画];
//将self设置为代理,以便在动画完成时接收通知
theGroup.delegate=self;
组。持续时间=持续时间;
//CAAnimation对象支持任意键值对,我们添加UIView标记
//稍后动画完成时识别动画的步骤
[组设置值:[NSNumber Number Withint:flipView.tag]forKey:@“viewFlipTag”];
//在这里,您可以向阵列添加其他动画
theGroup.animations=[NSArray数组及其对象:transformAnimation,nil];
Group.removedOnCompletion=否;
//将动画组添加到层中
[flipView.layer addAnimation:theGroup forKey:@“flipView”];
} 决定如下: 创建遮罩(图像)颜色=黑色,使区域大小=按钮。大小颜色=透明 image name=“mask2.png”


好的,那我们怎么帮你呢?我想让图像在按钮下旋转。我该如何制作?图像问题 [AnimationUtil rotationRightToLeftForView:image andDuration:1];

Animation metod
button = ...;
ImageView = ...;
parent_view = ...;

UIImage *_maskingImage = [UIImage imageNamed:@"mask2"];
CALayer *_maskingLayer = [CALayer layer];
_maskingLayer.frame = parent_View.bounds;
[_maskingLayer setContents:(id)[_maskingImage CGImage]];

CALayer *layerForImage = [[CALayer alloc] init];
layerForImage.frame = parent_View.bounds;
[layerForImage setMask:_maskingLayer];
[layerForImage addSublayer:ImageView.layer];

[parent_View.layer addSublayer:layerForImage];
[parent_View addSubView:button];