【问题标题】:Rotate between 2 views在 2 个视图之间旋转
【发布时间】:2013-01-20 16:53:24
【问题描述】:

我有两种观点。如何通过旋转在它们之间转换?我想旋转第一个视图以获得第二个视图...谢谢。

我尝试使用 [UIView transitionFromView 但它没有旋转参数。

【问题讨论】:

    标签: objective-c cocoa-touch ios4 ios6


    【解决方案1】:

    这可能是您所期望的。但是,与您预期的不太一样,因为它没有使用过渡动画来简单地添加或删除子视图。

    UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(60, 140, 200, 200)];
    view1.backgroundColor = [UIColor greenColor];
    [self.view addSubview:view1];    
    UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(60, 140, 200, 200)];
    view2.backgroundColor = [UIColor redColor];
      [self.view addSubview:view2];
    view2.alpha = 0;
    [UIView transitionWithView:view1 duration:2.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        view1.transform = CGAffineTransformMakeRotation(M_PI/2);
    } completion:^(BOOL com){
        view2.alpha = 1;
        [view1 removeFromSuperview];
    }];
    

    【讨论】:

      猜你喜欢
      • 2014-07-17
      • 1970-01-01
      • 2013-12-13
      • 2016-09-22
      • 2012-08-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多