[英]iPhone slide animation when view is loaded
在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
}];
}
為什么不?
-(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];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.