In my view controller I am setting the titleView
to a UIView
which contains a UIImageView
which is made into a circle using setCornerRadius on its layer.
The top half of the circle is positioned over the navbar, and the bottom half over the view, like this:
Now when I push this view controller, as it animates in, the bottom half of the circle is cut off until the animation completes. Only the part that's in the navbar is shown, something like this:
As soon as the push animation ends, the full circle is shown. Is there any way I can stop the navigation bar from masking/cutting off the titleView
while the animation takes place, so that the full circle is shown during the animation?
I'm not sure you should want to do this.
Anyway: add the circle to your UIWindow (on top of your UINavigationController). I suppose you want to position the circle in the center of your screen (horizontally). You can use a transition coordinator (iOS 7.0 +) to animate the circle alongside the transition of your view controller (push or pop). Note that this only works for animated transitions (i.e. when
animated
is set). Therefore, we need to set the new frame manually whenanimated
isn't set.Replace
110.f
with your position (110.f = ((320.f - 100.f) / 2.f)
).Now, you need to use a transition coordinator to animate the pop as well.
And finally, remove the circle from your key window as soon as your view controller has disappeared (note that this does not necessarily mean your view controller is popped, and you can always readd the circle view to the key window again in
viewWillAppear:
).