How to get notified when a tableViewController finishes animating the push onto a nav stack

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?

Answers


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

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];
}    

Have you tried simply calling the selectRowAtIndexPath:animated:scrollPosition: method (via the tableView property) before you push it onto the navigation controller's stack?


Need Your Help

MVC 4 - Entity Framework, ViewModel and Object Context

c# asp.net-mvc entity-framework

I'm using Entity Framework with MVC 4 to develop a web application. I'm also using a ViewModel named VehicleTypeViewModel which is created like this :

Hide Function parameter from URL when a request is made

php url cakephp routing

I want to hide the action parameters from my url when a request to a particular action is made. For instance,

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.