iOS:橫向使用iPhone預設的翻頁效果,iosiphone

來源:互聯網
上載者:User

iOS:橫向使用iPhone預設的翻頁效果,iosiphone

大致思路使用兩層輔助UIView的旋轉來實現添加後的View的橫向翻頁效果

    CATransform3D transformA = CATransform3DRotate(CATransform3DIdentity, degreesToRadian(90), 0, 0, 1.0f);     CATransform3D transformB = CATransform3DRotate(CATransform3DIdentity, degreesToRadian(180), 0.0f, 1.0f, 0.0f);     bgview.layer.transform = CATransform3DConcat(transformA, transformB);         CATransform3D transform3DA = CATransform3DRotate(CATransform3DIdentity, degreesToRadian(90), 0, 0, 1.0f);     CATransform3D transform3DB = CATransform3DRotate(CATransform3DIdentity, degreesToRadian(180), 0.0f, 1.0f, 0.0f);         superView.layer.transform = CATransform3DConcat(transform3DA, transform3DB);

 

View的層次:superView──bgView──自己的View

 

    向bgView中添加自己的View(註:要在bgView的subViews多於一個時才有翻頁效果)

    [UIView beginAnimations:@"view transition" context:nil];     [UIView setAnimationDuration:1.0];     [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:bgView cache:NO];
    [bgView addSubview:viewController.view];

 

 

這樣做一是實現了橫向翻頁,二是保證你自己的View添加之後的方向是正確的,試試就知道為什麼非要弄兩層來輔助了,至於旋轉後的Frame變化問題就看自己的使用方式調整了,尤其注意頂層View(添加進去的View)的Touch事件可能無法識別到,是因為底層View(bg和super View)旋轉後的Frame出了問題!!!

不知道有沒有其他的好方法,如果各位有更好的方法還望賜教!


iphone5是不是只可以橫向翻頁,不可以豎向翻頁,我用的所有效果都是只可以橫著滑

沒有豎著滑的,內建系統沒有這個功能,也許某些外掛程式可以實現這個功能吧。
安卓的倒是可以豎著來。其實用起來不都一樣嗎
 
安卓手機主畫面怎增加橫向翻頁??本來手機橫向翻頁是5頁,,現在變成3頁,,怎設定??

我的是按菜單鍵。然後添加
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.