2

我尝试使 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];
4

1 回答 1

0

尝试将 90 度旋转应用于视图的超级视图的变换。这应该会改变视图的坐标空间,因此应用于子视图的卷曲过渡应该在旋转坐标中卷曲。

您可能必须创建多个视图以防止您的内容被旋转:

外视图,旋转 90 度。

中间视图 - 这是获得卷曲过渡的视图

   inner view, rotated -90 degrees, and containing your actual content.

我没有尝试过,但这应该可以。

请注意,您切换到的视图必须是中间视图/内部视图组合。

于 2012-05-17T00:05:22.697 回答