zoukankan      html  css  js  c++  java
  • iOS:横向使用iPhone默认的翻页效果

    大致思路使用两层辅助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出了问题!!!

    不知道有没有其他的好方法,如果各位有更好的方法还望赐教!

  • 相关阅读:
    Assembly Manifest 通俗简易手册
    CruiseControl服务器安装配置
    关于URL编码
    从A到Z来说说Web开发
    通过注册表查看 .NET Framework的版本信息
    云数据存在哪里?
    C#中你可能不知道的8件事(zz)
    用PBKDF2 或BCrypt 来存储密码
    C++编译器什么时候为我们自动生成拷贝构造函数?
    C#中你可能不知道的8件事(zz)
  • 原文地址:https://www.cnblogs.com/lovewx/p/4010672.html
Copyright © 2011-2022 走看看