2011-08-26 60 views
2

我嘗試使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]; 

回答

0

嘗試將90度旋轉應用於視圖的超視圖變換。這應該會改變視圖的座標空間,所以應用於子視圖的捲曲轉換應該旋轉座標。

您可能需要創建多個視圖,讓您的內容被旋轉:

外視圖,旋轉90度。

中間視圖 - 這是獲取捲曲過渡

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

我還沒有嘗試過的觀點,但應該工作。

請注意,您切換到的視圖必須是中間視圖/內部視圖組合。