After creating a custom view and assigning it to the navigationItem.titleView property it is displayed like this

with the custom view filling the space between the two buttons. Therefore, the custom view is not centered on the navigation bar. How do I determine the frame of the view in the .titleView property? I want to center some text in the navigation bar, say under the time stamp.
If you really want to get
titleView‘s frame (in your top-level view’s coordinate space), you can do this:You need to do
layoutIfNeededif you have just assignedtitleView, because by default the navigation bar won’t lay out its subviews until the next pass through the run loop.That said, the
titleViewwill be centered automatically, if it fits. I think you are setting the frame (or bounds) of your custom view too large. I tested this two ways:I set up the

titleViewdirectly in the XIB. I simply dragged a View from the Object library onto the center of the navigation bar:It sized the view to 128×33 automatically. The resize handles let me adjust the size. It stays centered until it overlaps the Categorize button. Then it shifts left.
I set the
titleViewproperty inviewDidLoad:The result looks like this:
