我有一個UIView
動畫與的iOS - [UIView的setAnimationDidStopSelector:@selector(animationDidStop:成品::)背景]所謂太快
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]
出於某種原因,animationDidStop:finished:context:
動畫結束前被調用。 任何想法? (上iOS7
模擬器測試)
代碼:
-(void)checkForAndRemoveTable {
//The animation should fade to 0 then remove itself from it's superview at the end.
if (tableViewController.view.superview != nil) {
[UIView beginAnimations:@"dismissTable" context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
tableViewController.view.alpha = 0;
[UIView commitAnimations];
}
}
-(void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
if ([animationID isEqualToString:@"dismissTable"]) {
[tableViewController.view removeFromSuperview];
}
}
同樣的問題,當我用這個,但我找到了原因!看起來我錯誤地(從另一個函數)調用包含我的動畫兩次的函數。請用「請參閱解決方案的意見」更新您的答案。謝謝。 – Zigglzworth