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. 背部图像内部不显示
- 2. iOS - 旋转视图显示背景
- 3. 使用ui-coverflow翻转图像以显示一些细节
- 4. 垂直翻转按钮背景图像
- 5. 翻转图像
- 6. 翻转图像
- 7. 翻转图像
- 8. 翻转图像
- 9. WPF按钮中的背景图像显示为水平翻转(如镜子)
- 10. iPhone - 翻转视图显示白色背景
- 11. 背景图像显示
- 12. 不显示背景图像
- 13. 不显示背景图像
- 14. 背景图像dosnt显示
- 15. Matlab - 显示背景图像
- 16. 背景图像不显示
- 17. 不显示背景图像
- 18. CSS图像缩略图翻转显示文字
- 19. javascript - 翻转图像
- 20. 在IOS中显示图像
- 21. iOS Launchscreen.storyboard图像未显示
- 22. 在iOS中显示图像
- 23. 翻转弹出360度并在其中显示图像
- 24. CSS:在子背景图像上显示父级背景图像
- 25. 背景图像不显示在IOS设备
- 26. 不显示在ios上的背景图像
- 27. MasterDetailPage背景图像不显示在IOS中xamarin.forms
- 28. iOS背景图像无法正常显示?
- 29. FFMPEG显示图像顶部
- 30. 的iOS如何翻转视图/图像和保存规模
从git hub检查出这个项目,这可以帮助你。 http://advanceioscode.blogspot.com/2015/11/colour-memory-44-grid-project.html – GameLoading
谢谢您的项目链接。这正是我所期待的。再次感谢帮助。我期待尽快为社区做出贡献。 –
我不确定我是否理解翻转图像以揭示它的背面。你在谈论水平翻转过渡吗? –