0

在 iPhone 应用程序中加载视图时如何执行滑动动画?

我有一个 ViewController,其中有子视图。我希望子视图加载动画,从左向右滑动。

到目前为止我得到了这个代码:

-(void) showAnimation{

    [self.view addSubview:geopointView]
    geopointView.frame = CGRectMake(20,150,550,200)// somewhere offscreen, in the direction you want it to appear from
    [UIView animateWithDuration:10.0 
         animations:^{
             geopointView.frame = CGRectMake(20,150,550,200)// its final location
    }];
}
4

1 回答 1

0

为什么不?

-(void) showAnimation{
[self.view addSubview:geopointView]
geopointView.frame = CGRectMake(-200,150,550,200)// just set a different frame
[UIView animateWithDuration:10.0 
             delay:0.0
             options:UIViewAnimationCurveEaseOut
             animations:^{
                 geopointView.frame = CGRectMake(20,150,550,200)// its final location
             }
             completion:nil];
}
于 2012-08-08T05:42:03.700 回答