2012-08-21

iOS: nested push animation can result in corrupted navigation bar


Today I got a very strange error by running an iOS App:

1. nested push animation can result in corrupted navigation bar
2. Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

It happens when the view controller tries to pop to top view controller without waiting for the loading end of child view controller.

Solution:

1. try to set a boolean variable to mark the view controller should pop to the top view controller
2. in viewDidAppear:(BOOL)animated method, check if a call of [self.navigationController popToRootViewControllerAnimated:YES] is needed

The reason:

popToRootViewControllerAnimated() must be called after the view appears!

2012-08-06

Fixing double entries in "Open with" menu under Mac OS X

Sometimes it is very annoying to see duplicated entries in the "Open with..." menu under MAC OS X, the reason is just the database for file types doesn't refresh for some reason. Now it can be fixed using:

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Tested under Mac OS X 10.8 (Mountain Lion).