0

我使用自定义 segue 从 tableview 到详细视图控制器。

    @implementation QuickNoteFlipSegue

- (void) perform {

    UIViewController *src = (UIViewController *) self.sourceViewController;
    UIViewController *dst = (UIViewController *) self.destinationViewController;
    dst.navigationItem.hidesBackButton = YES;
    [UIView transitionWithView:src.navigationController.view duration:1.00
                       options:UIViewAnimationOptionTransitionCurlUp
                    animations:^{
                        [src.navigationController pushViewController:dst animated:NO];
                    }
                    completion:^(BOOL finished){
                        if (finished) {
                                                        }
                    }];


}


@end

转换完成后我想做什么,弹出我的文本视图的键盘。

我目前通过调用来做到这一点

[textView 成为FirstResponder];

这会弹出键盘 OK 但在过渡动画完成之前。如何在弹出键盘之前检测动画何时完成?

我也许应该放一些东西是动画的完成,但是如何让自定义 segue 知道它的目的地中的 textview 呢?

4

2 回答 2

1

做:

-(void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [textView becomeFirstResponder];
}
于 2013-01-07T11:55:18.477 回答
0

添加一个方法到你的DestinationViewController

-(void)openKeyboard
{
    [textView becomeFirstResponder];
}

然后改变你的perform方法:

- (void) perform {

    UIViewController *src = (UIViewController *) self.sourceViewController;
    DestinationViewController *dst = (DestinationViewController *) self.destinationViewController;
    dst.navigationItem.hidesBackButton = YES;
    [UIView transitionWithView:src.navigationController.view duration:1.00
                       options:UIViewAnimationOptionTransitionCurlUp
                    animations:^{
                        [src.navigationController pushViewController:dst animated:NO];
                    }
                    completion:^(BOOL finished){
                        if (finished) {
                            [dst openKeyboard];
                        }
                    }];
}
于 2013-01-07T12:28:05.900 回答