如何在tableViewController完成动画推送到导航堆栈时收到通知 [英] How to get notified when a tableViewController finishes animating the push onto a nav stack

查看:77
本文介绍了如何在tableViewController完成动画推送到导航堆栈时收到通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 UITableViewController 推送到 UINavigationController ,其中包含 pushViewController:animated:。我希望在动画结束时得到通知,这样我就可以使用 selectRowAtIndexPath 滚动并突出显示给定的行。

如何设置我没有明确调用动画的代表?

I'm pushing a UITableViewController onto a UINavigationController with pushViewController:animated:. I'd like to be notified the moment the animation finishes so I can use selectRowAtIndexPath to scroll to and highlight a given row.
How can I set the delegate of an animation I didn't call explicitly?

推荐答案

我知道无法设置推送动画的委托。这是一个简单的解决方法:

I know of no way to set the delegate of the push animation. Here's a simple workaround:

子类 UITableViewController 。覆盖 viewDidAppear:在短暂延迟后调用动画后方法。

Subclass UITableViewController. Override viewDidAppear: to call your "post-animation" method after a short delay.

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self performSelector:@selector(scrollToAndHighlightCurrentRow) withObject:nil afterDelay:0.4];
}    

这篇关于如何在tableViewController完成动画推送到导航堆栈时收到通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆