UIViewAnimationTransitionCurlUp 水平工作
我尝试使 UIViewAnimationTransitionCurlUp 水平工作,因此我旋转应用动画的视图。但是这不起作用,动画保持从底部到顶部。有什么想法吗?
first = [[PDFPortraitView alloc] initWithFrame:CGRectMake(0, 0, 960, 768) andCurrentPage:currentPage];
container = [[UIView alloc] initWithFrame:CGRectMake(-96, 140, 960, 768)];
container.backgroundColor = [UIColor redColor];
container.transform = CGAffineTransformMakeRotation(M_PI * (0.5));
[self.view addSubview:container];
[container addSubview:first];
second = [[PDFPortraitView alloc] initWithFrame:CGRectMake(0, 0, 960, 768) andCurrentPage:currentPage];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5f];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:container cache:NO];
[first removeFromSuperview];
[container addSubview:second];
[UIView commitAnimations];
I try to make the UIViewAnimationTransitionCurlUp work horizontally so, I rotate the view where the animation is applied. But the didn't work, the animation stay from the bottom to the top. Any idea?
first = [[PDFPortraitView alloc] initWithFrame:CGRectMake(0, 0, 960, 768) andCurrentPage:currentPage];
container = [[UIView alloc] initWithFrame:CGRectMake(-96, 140, 960, 768)];
container.backgroundColor = [UIColor redColor];
container.transform = CGAffineTransformMakeRotation(M_PI * (0.5));
[self.view addSubview:container];
[container addSubview:first];
second = [[PDFPortraitView alloc] initWithFrame:CGRectMake(0, 0, 960, 768) andCurrentPage:currentPage];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5f];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:container cache:NO];
[first removeFromSuperview];
[container addSubview:second];
[UIView commitAnimations];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试对视图的超级视图的变换应用 90 度旋转。这应该会改变视图的坐标空间,因此应用于子视图的卷曲过渡应该在旋转坐标中卷曲。
您可能必须创建多个视图以防止内容旋转:
外部视图,旋转 90 度。
中间视图 - 这是获得卷曲过渡的视图
我还没有尝试过,但应该可以。
请注意,您切换到的视图必须是中间视图/内部视图组合。
Try applying a 90 degree rotation to your view's superview's transform. That should transform your view's coordinate space, so a curl transition applied to the child view should curl in rotated coordinates.
You might have to create multiple views to keep your content from being rotated:
outer view, rotated 90 degrees.
middle view - this is the view that gets the curl transition
I haven't tried it, but that should work.
Note that the view you switch to will have to be a middle view/inner view combo.