我有一个项目,其中包含一个动态创建和格式化的表,而不使用IB。问题是,表格需要在轮换期间更改值和大小。但是,调整大小是不稳定的并且在动画期间突然发生。目前我正在使用didRotate方法,在该方法中我调用重载方法以调整其大小。我应该使用不同的方法来做到这一点,还是至少要平滑调整大小?
编辑:我正在尝试在willRotateToInterfaceOrientation:中使用替换/调整大小,或者可能是两步动画。但是,这些方法永远不会被调用,这是由于视图层次结构(我试图调整大小的视图是拆分视图的一部分)?
答案 0 :(得分:0)
您是否告诉didRotate方法在进行更改时使用动画?例如,这是一个进行翻转过渡的代码片段。关键是使用“beginAnimations”和“commitAnimations”告诉iPhone如何处理这些更改。中间的代码描述了这些变化。当调用“commitAnimations”时,这些更改会被神奇地动画化.
[UIView beginAnimations:@"leftPortrait" context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:1.0f];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:leftView cache:YES];
[leftWebView setFrame:CGRectMake(0, 0, 384, 916)];
[UIView commitAnimations];
希望这有帮助。