当我在 iOS 中旋转对象时,如何使对象从一侧出现?(代码+ gif)里面 [英] how to make objects appear from one side when I rotate them in iOS ? (code + gif ) inside

查看:20
本文介绍了当我在 iOS 中旋转对象时,如何使对象从一侧出现?(代码+ gif)里面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 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 side] 的功能,我想在这里关闭它,但 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

来自苹果的网站:-

一个布尔值,指示图层在何时显示其内容背对着观众.可动画.

A Boolean indicating whether the layer displays its content when facing away from the viewer. Animatable.

这篇关于当我在 iOS 中旋转对象时,如何使对象从一侧出现?(代码+ gif)里面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆