這淡入並通過按下一個按鈕,褪色的UIView,但目前看來,這個代碼可以寫更好:這是正確的方式淡入淡出UIView嗎?
- (IBAction)navigationTap:(id)sender {
if (navigationFolded == TRUE) {
[UIView beginAnimations:@"MoveOut" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:0.2f];
self.moveMe.frame = CGRectMake(0, 0, _moveMe.bounds.size.width, _moveMe.bounds.size.height);
[UIView commitAnimations];
navigationFolded = FALSE;
} else {
[UIView beginAnimations:@"MoveIn" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:0.2f];
self.moveMe.frame = CGRectMake(50-_moveMe.bounds.size.width, 0, _moveMe.bounds.size.width, _moveMe.bounds.size.height);
[UIView commitAnimations];
navigationFolded = TRUE;
}
我想「淡入/淡出」應該是指改變視圖的透明度,而不是框架?你還應該使用UIView – Vladimir 2013-04-26 14:49:39
的更新的基於塊的動畫方法,uiview從顯示器的左側淡入...... 你對「基於較新塊的動畫」有何意義? – greenchapter 2013-04-26 14:51:08
如果它從左邊開始,那麼它「滑入」?無論如何,我不是母語爲英語的人,我可能是錯的。檢查[UIView animateWithDuration:...]方法和類似的 – Vladimir 2013-04-26 14:52:23