I am using a UIImageView-based animation to show a custom activity indicator. The following code is responsible for setting this :
+ (void)startLoadingActivity:(UIViewController *)vc {
vc.parentViewController.navigationItem.titleView = [UIImageView imageViewWithPath:@"loading_" count:10 duration:1.3 frame:CGRectMake(0, 0, 22, 22)];
}
Here is a gist with the UIImageView+Animation category.
Whenever I am starting a web request, I am starting the activity indicator, and whenever the request is done, I am stopping it by setting the titleView property to nil.
The result is this:

The request method is also called into the -viewDidAppear: method of the view controller.
However, whenever the animation starts during a transition, it seems like the position of the UIImageView is wrong.
The following result is showing the problem:
Please notice how the activity indicator is showing on top of the "Groups" button.

Where is this problem coming from? How can I solve it?