0
我已經做了很多嘗試,以獲得與撥打電話號碼時看到的效果相同的效果:正面視圖會放大縮小效果,而另一個也會出現縮放效果。動畫兩個視圖,如當你通過電話撥打
我無法做到這一點,它總是馬馬虎虎。似乎有一個規模效應,對不透明度的行動,但...
你知道如何做到這一點反映出這種效果(不是那麼回事,我有噸)?
我已經做了很多嘗試,以獲得與撥打電話號碼時看到的效果相同的效果:正面視圖會放大縮小效果,而另一個也會出現縮放效果。動畫兩個視圖,如當你通過電話撥打
我無法做到這一點,它總是馬馬虎虎。似乎有一個規模效應,對不透明度的行動,但...
你知道如何做到這一點反映出這種效果(不是那麼回事,我有噸)?
// Make this interesting.
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.view cache:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];
self.view.alpha = 0.0;
self.view.frame = CGRectMake(self.view.center.x,self.view.center.y , 0, 0);
[UIView commitAnimations];
}
我希望這是一個更好的動畫框架。它不能保證能夠工作,但這是我在轉換的第一部分所能想到的最好的。
這將改變視圖控制器視圖的框架,使其「吸」到屏幕的中心,這是一種天然的黑色。現在我想到了,一個CGAffineTransform會容易得多...
編輯(爲了學習的目的):從iOS 4開始,您現在可以使用更新的語法更清晰的動畫塊和不錯的變換:
[UIView animateWithDuration:0.25 delay:0.0 options:0 animations:^{
//animate the toolbars in from the top and bottom
[myTopView setFrame:CGRectMake(0, self.view.frame.size.height - 44, self.view.frame.size.width, 44)];
[myBottomView setFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
//fade to black...
self.view.alpha = 0.0;
//and suck inwards.
self.view.frame = CGRectMake(self.view.center.x,self.view.center.y , 0, 0);
}
completion:^{
//do something to end nicely, or start another animation block.
}];
爲什麼我既是最佳答案又是被拒絕的人? – CodaFi
可能是因爲答案有效,但它不能很好地解釋...... –
噢,減倉,蒙弗裏。我小時候就發佈了這個。我會立即編輯它。 – CodaFi