IOS开发 阅读器的横屏创作

本文小白 仅供提醒.

  注意 是视图的旋转 不是屏幕的旋转. 

其实 难点就是 坐标的改变............

- (void)buttonChange:(UIButton *)button

{

  

    

    self.stateBar.frame = CGRectMake(self.view.bounds.size.width - 50, self.view.bounds.origin.y, 49, self.view.bounds.size.height);

    self.buttonBar.frame = CGRectMake(self.view.bounds.origin.x, self.view.bounds.origin.y, 44, self.view.bounds.size.height);

    

    // toolBar 控件 创建一个新的视图

    

    _myslider.frame = CGRectMake(- 80 + self.view.bounds.origin.x, 150, 200, 20);

    _myslider.transform = CGAffineTransformMakeRotation((90.0f * M_PI) / 180.0f);

    _lightButton.frame = CGRectMake(self.view.bounds.origin.x + 10, 380, 30, 30);

    _lightButton.transformCGAffineTransformMakeRotation((90.0f * M_PI) / 180.0f);

    // light

    _lightslider.frame = CGRectMake(self.view.bounds.origin.x + 100, 200, 150, 32);


    _lightslider.transformCGAffineTransformMakeRotation((90.0f * M_PI) / 180.0f);

    

    

    _zhanButton.frame = CGRectMake(10 + self.view.bounds.origin.x, 30, 0, 0);

    

    //

    _mylabel.frame = CGRectMake(self.view.bounds.origin.x - 20, self.view.bounds.origin.y + 250 , 100, 32);

    _mylabel.transform = CGAffineTransformMakeRotation((90.0f * M_PI) / 180.0f);

    // 分享按钮

    _sharebutton.frame = CGRectMake(self.view.bounds.origin.x + 10, self.view.bounds.origin.y + 400, 30, 30);

    _sharebutton.transform = CGAffineTransformMakeRotation((90.0f * M_PI) / 180.0f);


    self.scrollview.contentSize = CGSizeMake(self.view.bounds.size.height, 720*self.myslider.maximumValue);

    self.scrollview.contentOffset = CGPointMake(0, 720);

    self.scrollview.pagingEnabled = NO;


    [UIView beginAnimations:@"clockwiseAnimation" context:NULL];


    [UIView setAnimationDuration:1.0f];

    [UIView setAnimationDelegate:self];

   

    //顺时针旋转90

    self.scrollview.transform = CGAffineTransformMakeRotation((90.0f * M_PI) / 180.0f);

   

    

    self.scrollview.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);

    

    for (UIView *aView in self.scrollview.subviews)

    {

        NSLog(@"aView1 = %@", NSStringFromCGRect(aView.frame));

        if ((aView.tag - 1000) >= 0)

        {

            float orgX = aView.frame.origin.x/320 * 720;

            NSLog(@"orgX = %f", orgX);

            aView.frame = CGRectMake(0, orgX, self.view.bounds.size.height, 720);

            NSLog(@"aView2 = %@", NSStringFromCGRect(aView.frame));

        }

       

    }

  

    [UIView commitAnimations];

    

    

}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值