1
A
回答
3
我不确定你到底想要达到什么目的,但是我正在使用此功能来水平旋转图像并在转换过程中更改图像。希望能帮助到你。
private func flipImageView(imageView: UIImageView, toImage: UIImage, duration: NSTimeInterval, delay: NSTimeInterval = 0)
{
let t = duration/2
UIView.animateWithDuration(t, delay: delay, options: .CurveEaseIn, animations: {() -> Void in
// Rotate view by 90 degrees
let p = CATransform3DMakeRotation(CGFloat(GLKMathDegreesToRadians(90)), 0.0, 1.0, 0.0)
imageView.layer.transform = p
}, completion: { (Bool) -> Void in
// New image
imageView.image = toImage
// Rotate view to initial position
// We have to start from 270 degrees otherwise the image will be flipped (mirrored) around Y axis
let p = CATransform3DMakeRotation(CGFloat(GLKMathDegreesToRadians(270)), 0.0, 1.0, 0.0)
imageView.layer.transform = p
UIView.animateWithDuration(t, delay: 0, options: .CurveEaseOut, animations: {() -> Void in
// Back to initial position
let p = CATransform3DMakeRotation(CGFloat(GLKMathDegreesToRadians(0)), 0.0, 1.0, 0.0)
imageView.layer.transform = p
}, completion: { (Bool) -> Void in
})
})
}
不要忘记导入GLKit。
+0
感谢您的指导。我也会试试这个。 –
0
-(void)showButtton
{
self.userInteractionEnabled = false;
[UIView transitionWithView:self duration:0.3 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{
//code to change the image of UIButton
} completion:^(BOOL finished) {
self.userInteractionEnabled = true;
}];
}
这是一个code这样做。
相关问题
- 1. 基金会4 - 图像翻转以显示另一个图像
- 2. 生成的图像显示翻转
- 3. 背部图像内部不显示
- 4. iOS - 旋转视图显示背景
- 5. 在iOS上不显示背景图像
- 6. 使用ui-coverflow翻转图像以显示一些细节
- 7. CSS卡片翻转不显示背面
- 8. 垂直翻转按钮背景图像
- 9. 翻转图像
- 10. 翻转图像
- 11. 翻转图像
- 12. 翻转图像
- 13. 翻转图像
- 14. iOS从翻转图像停止?
- 15. WPF按钮中的背景图像显示为水平翻转(如镜子)
- 16. Emgu cv显示摄像头流作为翻转图像
- 17. iPhone - 翻转视图显示白色背景
- 18. 在IE翻转动画:翻转侧显示镜像内容
- 19. 在背景图像顶部显示另一图像4
- 20. 不显示背景图像
- 21. 背景图像不显示
- 22. Matlab - 显示背景图像
- 23. 背景图像不显示
- 24. 不显示背景图像
- 25. 背景图像显示
- 26. 不显示背景图像
- 27. 背景图像dosnt显示
- 28. 不显示背景图像
- 29. 图像与背景图像不显示
- 30. qTip2翻转缩略图显示全尺寸图像
从git hub检查出这个项目,这可以帮助你。 http://advanceioscode.blogspot.com/2015/11/colour-memory-44-grid-project.html – GameLoading
谢谢您的项目链接。这正是我所期待的。再次感谢帮助。我期待尽快为社区做出贡献。 –
我不确定我是否理解翻转图像以揭示它的背面。你在谈论水平翻转过渡吗? –