Iphone 试图订购内置的UIAnimations,但没有多大成功

Iphone 试图订购内置的UIAnimations,但没有多大成功,iphone,cocoa-touch,iphone-sdk-3.0,core-animation,Iphone,Cocoa Touch,Iphone Sdk 3.0,Core Animation,好的,我的iPhone应用程序中有一个屏幕,如下所示: (来源:) 当“添加注释”单元格被触摸时,我希望键盘消失,然后我希望它以模式显示“编辑注释”屏幕(该屏幕也有一个键盘,但我希望它在屏幕上重新设置动画) 现在,它一次为所有东西设置动画(键盘永远不会消失,它只是改变它的外观,而新的视图会以模态方式在键盘下方设置动画)。整个效果运行正常,但有点不稳定,我认为在屏幕上弹出模式视图之前先将键盘滑下会更平滑。我见过其他应用程序做我想做的事情(例如事情),所以我知道这是可能的 有没有人能为我指出正确的

好的,我的iPhone应用程序中有一个屏幕,如下所示:
(来源:)

当“添加注释”单元格被触摸时,我希望键盘消失,然后我希望它以模式显示“编辑注释”屏幕(该屏幕也有一个键盘,但我希望它在屏幕上重新设置动画)

现在,它一次为所有东西设置动画(键盘永远不会消失,它只是改变它的外观,而新的视图会以模态方式在键盘下方设置动画)。整个效果运行正常,但有点不稳定,我认为在屏幕上弹出模式视图之前先将键盘滑下会更平滑。我见过其他应用程序做我想做的事情(例如事情),所以我知道这是可能的

有没有人能为我指出正确的方向,让每个转换单独进行,而不是一次完成

编辑:根据要求,这里是我正在使用的一些代码。不幸的是,目标C中的内容与英语中的内容几乎完全相同

  UITableViewController* tableViewController = (UITableViewController*)tableView.dataSource;

  AddNotesViewController* addNotesViewController = [[AddNotesViewController alloc] initWithWine:[self myWine]];

  UINavigationController* addNotesNavController = [[[UINavigationController alloc] initWithRootViewController:addNotesViewController] autorelease];

  // tell the name override cell to resign if they need to
  [(NewWineViewController*)tableView.dataSource resignNameCell];

  //I'd like the animation caused by the resign to complete before proceeding.

  [tableViewController.navigationController presentModalViewController:addNotesNavController animated:YES];
我认为这应该奏效:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
    UITextField *textField = // the field that the keyboard is up for
    [textField resignFirstResponder];

    NSTimeInterval delay = 2.0; // i.e., until keyboard has disappeared
    [self performSelector: @selector(transitionToEditNotesScreen) withObject: nil afterDelay: delay];
}

- (void) transitionToEditNotesScreen
{
    // the code you have above to bring on the modal view controller        
}
在控制器中为编辑注释屏幕添加以下代码。如果希望在模式视图完全显示后重新启用键盘动画,请将其置于ViewDidDisplay中。否则,将相同的代码放入viewDidLoad或ViewWillDisplay

- (void) viewDidAppear: (BOOL) animated
{
    UITextField *textField = // the field you want the keyboard to be up for
    [textField becomeFirstResponder];
}

您可以发布您现在拥有的代码片段吗?只是好奇——您使用的是ViewDidDisplay还是ViewWillDisplay?