I add a UILabel
as the titleView
as self.navigationItem.titleView
. The width of the label is the width of the screen and the origin is CGZero. After I add a left and right bar item the UILabel
's origin and width changes in relation to the screen. I have to place something directly beneath the UILabel
with the same width however when I use convertRect
or convertPoint
I get the original values I have set for the frame which is incorrect relative to what is seen on screen.
What is the correct way to get the value of the titleView
's new frame as shown on the screen
Ah the issue was that I was querying the size of the title view too early as the sizing of the subviews are not calculated until the next pass in the run loop I solved it in the main view as so
navBar.layoutIfNeeded()
var titleViewFrameInTopLevelViewSpace:CGRect = self.navigationItem.titleView!.convertRect(self.navigationItem.titleView!.bounds, toView: self.view)
println(titleViewFrameInTopLevelViewSpace)
Thank you @rob-mayoff