【发布时间】:2015-11-24 07:45:12
【问题描述】:
我的代码如下,但动画只是立即发生,即视图不再可见:
UIView *leftDoorView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width /2, self.view.bounds.size.height)];
leftDoorView.backgroundColor = [UIColor greenColor];
leftDoorView.layer.anchorPoint = CGPointMake(0.0, 0.5);
[self.view addSubview:leftDoorView];
leftDoorView.center = CGPointMake(0.0, self.view.bounds.size.height/2.0); //compensate for anchor offset
CATransform3D transform = CATransform3DIdentity;
transform.m34 = -1.0f/500.0;
transform = CATransform3DRotate(transform, M_PI_2, 0, 1, 0);
[UIView animateWithDuration:1.0 animations:^{
leftDoorView.layer.transform = transform;
}];
不确定我做错了什么 - 请提供任何帮助。
【问题讨论】:
-
我刚刚将您的代码复制到应用程序的 viewDidAppear: 中,它可以正确显示动画。
标签: ios core-graphics core-animation