当我在iOS中旋转对象时,如何使对象从一侧出现? (code + gif)里面 [英] how to make objects appear from one side when I rotate them in iOS ? (code + gif ) inside
问题描述
当我在iOS中旋转对象时,如何让对象显示(仅限一侧)?
how to make objects appear from (one side only), when I rotate them in iOS ?
我想要发生什么,(你可以看到我可以将另一张脸添加到我的UITableview单元格中)
What I want to happen, (as you can see i can add another face to my UITableview cell)
发生了什么,我甚至无法添加另一张脸,因为前一张脸再次出现
What is happening, i can't even add another face since the previous one is showing up again
我正在使用的代码
func animate()
{
var id = CATransform3DIdentity
id.m34 = -1.0 / 1000
var transformAnim = CAKeyframeAnimation(keyPath:"transform")
transformAnim.values = [
NSValue(CATransform3D: CATransform3DRotate(id, 0 * CGFloat(-M_PI_2), 0, 1.0, 0)),
NSValue(CATransform3D: CATransform3DRotate(id, 1 * CGFloat(-M_PI_2), 0, 1.0, 0)),
NSValue(CATransform3D: CATransform3DRotate(id, 0 * CGFloat(-M_PI_2), 0, 1.0, 0))
]
transformAnim.keyTimes = [0, 0.5, 1.0]
transformAnim.duration = 0.7
self.imageViewLogo.layoutIfNeeded()
self.imageViewLogo.layer.addAnimation(transformAnim, forKey: "transform")
}
例如,如果您知道3ds max中名为[force 2 sided]的功能,我希望它在此处转动,但似乎iOS没有这样的功能。
If you know a feature called [force 2 sided] in 3ds max for example, I want it turned of here, but it seems that iOS has no feature like this.
- 这是一个高级问题,我希望专家解答我。
谢谢。
编辑
如果你仍然不确定我在问什么,我的意思是:
if you are still not sure what I'm asking, I mean this :
如何让对象显示当我旋转时,只从一侧它?
how to make an object to show only from one side when i rotate it ?
推荐答案
解决方案是一个我之前从未听说过的简单陈述
the solution was a simple statement that I never heard of before
imageViewLogo.layer.doubleSided = false
来自apple的网站: -
from apple's website :-
一个布尔值,指示当
面临时,图层是否显示其内容来自观众。动画。
A Boolean indicating whether the layer displays its content when facing away from the viewer. Animatable.
这篇关于当我在iOS中旋转对象时,如何使对象从一侧出现? (code + gif)里面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!