0

我有一个视图控制器,加载时应该在视图中的特定点放大(然后动画缩小)。当它被 segue 推到导航堆栈的顶部时,它会很好地显示放大的区域。

但是,如果我转到我的 StoryBoard 并将该视图控制器设置为初始视图控制器,则在加载视图时会放大但旋转 90 度。不知道为什么。这是代码:

-(void)viewDidAppear:(BOOL)animated
{        
    //INITIAL TRANSFORM
    CGAffineTransform t1 = CGAffineTransformMakeTranslation(-50, 0); 
    CGAffineTransform t2 = CGAffineTransformTranslate(t1, 0, 250);
    CGAffineTransform t3 = CGAffineTransformScale(t2, 1.7, 1.7);
    self.view.transform = t3;

    //ZOOM OUT
    [UIView animateWithDuration:8
                          delay:1.5
                        options:UIViewAnimationCurveEaseOut animations:^{
                           // self.view.transform = CGAffineTransformIdentity;
                        }completion:nil
    ];
}

有什么想法吗?

4

1 回答 1

1

也许您应该使用视图中的初始转换:

   -(void)viewDidAppear:(BOOL)animated
    {        
        //INITIAL TRANSFORM
        CGAffineTransform t0 = self.view.transform;
        CGAffineTransform t1 = CGAffineTransformTranslate(t0, -50, 0); 
        CGAffineTransform t2 = CGAffineTransformTranslate(t1, 0, 250);
        CGAffineTransform t3 = CGAffineTransformScale(t2, 1.7, 1.7);
        self.view.transform = t3;

        //ZOOM OUT
        [UIView animateWithDuration:8
                              delay:1.5
                            options:UIViewAnimationCurveEaseOut animations:^{
                               // self.view.transform = CGAffineTransformIdentity;
                            }completion:nil
        ];
    }
于 2012-05-24T11:45:17.343 回答