I have 1 view, in this view I have 1 UIImageView and UILabel, when I rotate my view half of view disappear.

This is my code

viewToAnimate is the view cointains image and label.

CATransform3D _3Dt = CATransform3DRotate(viewToAnimate.layer.transform, DEGREES_TO_RADIANS(beginValue), 0.0, 1.0, 0);
_3Dt.m34 = 1.0 / -300;

viewToAnimate.layer.transform = _3Dt;

CATransform3D _scale;

if (needZoom) {
    _scale = CATransform3DScale(viewToAnimate.layer.transform , 1+scale, 1+scale, 1+scale);

    if (_scale.m11 > 1) {
        _scale.m11 = 1;
        _scale.m22 = 1;
        _scale.m33 = 1;
    }
}
else  {
    _scale = CATransform3DScale(viewToAnimate.layer.transform , 1-scale, 1-scale, 1-scale);
}

viewToAnimate.layer.transform = _scale;
//viewToAnimate.layer.zPosition = sin(DEGREES_TO_RADIANS(beginValue)*MOSAIC_WIDTH)+1;
有帮助吗?

解决方案

What is the value of DEGREES_TO_RADIANS? Is it by any chance M_PI/2? Your code tells that you are rotating around y-axis. See last 3 parameters in first line:

0.0, 1.0, 0

If you are supplying this then this is expected behavior - consider a plane facing you and imagine it rotate around y-axis by +/- 90 degrees, it will definitely disappear.

其他提示

As mentioned in Diego's comment on the other answer this can be caused by zPosition issues. Make your view above all the others by setting it's zPosition to a higher value.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top